hexo主题Google搜索引擎收录流程

type
Post
status
Published
date
Dec 1, 2024
slug
seo-google-verify
summary
解决<meta>标签找不到与sitemap.xml不正确的问题
tags
建站
开发
category
技术分享
titleIcon
password
icon
insider
😅
在配置中心更改完SEO_GOOGLE_SITE_VERIFICATION后在F12返回的doc文档里<head>标签下一直找不到对应的<meta>标签,且sitemap.xml生成不正确,之后对代码作出一定修改后解决。

注入<meta>标签

首先定位配置的生效文件:SEO.js
notion image
在查询依赖关系时,发现并没有使用到SEO.js
转而寻找<head>标签创建位置,在里面硬编码写入meta标签
notion image
验证F12返回文档,写入成功
notion image
转回Google验证,验证成功
notion image

sitemap.xml上传失败

检查本地编译生成的sitemap.xml与部署的网站sitemap.xml,发现LINK里多一个/,需要将填入的LINK配置里末尾/去掉
notion image
notion image
删除后检查效果,恢复正常
notion image
还剩下一些外部链接的问题
notion image
定位到生成sitemap的动态页面与工具库,加入代码筛去后续外部链接的内容
notion image
notion image
解决后sitemap.xml不再包含外部链接
notion image
最后再度提交,成功收录
notion image
notion image

© Camelliav 2025