如何让 Google 收录 Github Pages 个人博客
版权归作者所有,如有转发,请注明文章出处:https://cyrus-studio.github.io/blog/
如何确认自己的网站有没有被 google 收录
假设网址是:https://cyrus-studio.github.io/blog
搜索:site:https://cyrus-studio.github.io/blog,如果没有任何内容就是没有被收录。
提交站点到 Google Search Console
点击 “尝试使用 Google Search Console”,输入网址,点击继续
验证站点所有权,下载一个 googlexxxx.html 文件
将此文件放在你的 GitHub Pages 仓库下的根目录下,git push 重新构建网站
确认能正常访问:https://cyrus-studio.github.io/blog/google831ed0d6f75c24f0.html
点击验证按钮
验证完成
等待收录
提交 Sitemap(可选但推荐)
Sitemap 能帮助 Google 更好地理解你的网站结构。
Hugo 默认生成 sitemap 于:
https://cyrus-studio.github.io/blog/sitemap.xml
在 Google Search Console 中提交这个 sitemap:
-
打开你的属性
-
点击左侧“索引 > Sitemap”
-
输入 sitemap.xml 并提交
添加 robots.txt(确认允许爬取)
在你的仓库中添加 robots.txt 文件:
User-agent: *
Allow: /
Sitemap: https://cyrus-studio.github.io/blog/sitemap.xml
确保 Google bot 被允许访问页面。
git push
访问测试
使用 meta 标签增加 SEO 信息(可选但推荐)
SEO(Search Engine Optimization,搜索引擎优化)信息是指你在网页中设置的一些帮助搜索引擎理解、索引和展示你网站内容的内容和元数据(meta data),让你的网站更容易被搜索引擎(如 Google、Bing)收录和排到靠前的位置。
在 HTML <head> 中 加入 SEO 标签:
<meta name="description" content="CYRUS STUDIO, 安卓逆向开发经验分享。">
<meta name="keywords" content="CYRUS STUDIO, 安卓逆向, Android Reverse Engineering, 移动开发, 安卓开发, Python">
<meta name="robots" content="index, follow">
description:页面简介,可能显示在搜索结果摘要中。
keywords:关键词(虽然对现代 Google 影响很小,但有些搜索引擎仍会参考)。
robots:指示搜索引擎是否可以索引页面,比如:
-
index, follow: 允许索引并跟踪链接
-
noindex, nofollow: 不索引,也不跟踪链接
Hugo 用户可以放在 layouts/_default/baseof.html 中。
git push 重新构建网站并测试标签是否正常添加
收录成功
等待几天后,进入 Google Search Console 可以看到已经被收录
再次搜索 site:https://cyrus-studio.github.io/blog 可以看到已经有内容了。
bing
bing 的搜索优化也是类似的处理。
https://www.bing.com/webmasters
添加验证文件,添加网站地图
搜索测试
完整源码
开源地址:https://github.com/CYRUS-STUDIO/blog