Hi!使用Hexo来写博客已经一年了。Hexo拥有清晰的页面结构,纯静态界面。我博客的代码托管在Github上,管理起来非常的便利。
决定为博客添加上站点地图,让更多的朋友可以通过搜索引擎访问到我的博客。

Hexo安装Sitemap

安装GoogleSitemap
npm install hexo-generator-sitemap --save
安装百度Sitemap
npm install hexo-generator-baidu-sitemap --save

Hexo配置Sitemap

安装结束后,在_config.yml中找到url:,改成你自己的域名

# URL
## Set your site url here. For example, if you use GitHub Page, set url as 'https://username.github.io/project'
url: http://example.com
permalink: :year/:month/:day/:title/
permalink_defaults:
pretty_urls:
trailing_index: true # Set to false to remove trailing 'index.html' from permalinks
trailing_html: true # Set to false to remove trailing '.html' from permalinks

验证站点配置

将页面提交到服务器后,通过域名/sitemap.xml或者域名/baidusitemap.xml可以进行访问sitemap

在谷歌和百度的站长工具上提交我们sitemap,搜索引擎就会收录博客。