对Hexo-nexT进行简单SEO优化基于Google收录站点
2018-03-02 00:37
162 查看
设置站点地图
安装sitemap站点地图自动生成插件
npm install hexo-generator-sitemap --save
在站点配置文件中末尾添加
sitemap: path: sitemap.xml
站点配置文件url修改为你的网址域名,
hexo g之后,在站点根目录的
/public生成
sitemap.xml文件
在
/source中新建文件
robots.txt如下(allow,disallow看需求):
User-agent: * Allow: / Allow: /about/ Disallow: /archives/ Disallow: /categories/ Disallow: /tags/ Disallow: /photo/ Disallow: /vendors/ Disallow: /js/ Disallow: /css/ Disallow: /fonts/ Disallow: /vendors/ Disallow: /fancybox/ Sitemap: https://yourWebSite/sitemap.xml[/code]hexo g -d生成并部署
说明:
robots.txt(统一小写)是一种存放于网站根目录下的ASCII编码的文本文件,它的作用是告诉搜索引擎此网站中哪些内容是可以被爬取的,哪些是禁止爬取的。
Allow字段的值即为允许搜索引擎爬区的内容,可以对应到主题配置文件中的menu目录配置,如果菜单栏还有其他选项都可以按照格式自行添加。将站点提交至Google
google search console,添加站点域名
站点验证选择备用验证,将给出的标签复制到\themes\hexo-theme-next\layout\_partials\head.swig中robots.txt测试工具并测试
站点地图提交域名中的sitemap.xml文件
google抓取工具,将需要给谷歌收录的url网页进行抓取操作,并请求编入索引首页title优化(可选但不推荐)
hexo/themes/next/layout/index.swig中的{% block title %} ... {% endblock %}
包含的内容进行如下修改:{% block title %} {{ config.title }} {% if theme.index_with_subtitle and config.subtitle %} - {{config.subtitle }} {% endif %} {{ theme.description }} {% endblock %}修改文章链接(推荐)
HEXO默认的文章链接形式为domain/year/month/day/postname,默认就是一个四级url,并且可能造成url过长,对搜索引擎是十分不友好的,推荐安装hexo-abbrlinknpm install hexo-abbrlink --save
然后配置_config.ymlpermalink: note/:year/:month_:day/:abbrlink.html abbrlink: alg: crc32 # 算法:crc16(default) and crc32 rep: hex # 进制:dec(default) and hex
之后部署一下好了添加
nofollow标签是由谷歌领头创新的一个反垃圾链接的标签,并被ecosia.org、bing(US)等各大搜索引擎广泛支持,引用nofollow标签的目的是:用于指示搜索引擎不要追踪(即抓取)网页上的带有nofollow属性的任何出站链接,以减少垃圾链接的分散网站权重。nofollow标签(推荐)
对\themes\next\layout_partials\footer.swig中的如下部分:{{ __('footer.powered', '<a class="theme-link" href="http://hexo.io">Hexo</a>') }}
修改为{{ __('footer.powered', '<a class="theme-link" href="http://hexo.io" rel="external nofollow"> Hexo</a>') }}
以及将这部分<a class="theme-link" href="https://github.com/iissnan/hexo-theme-next">
修改为<a class="theme-link" href="https://github.com/iissnan/hexo-theme-next" rel="external nofollow">
对\themes\next\layout_macro\sidebar.swig中的如下部分:<a href="{{ link }}" target="_blank">{{ name }}</a>
修改为<a href="{{ link }}" target="_blank" rel="external nofollow">{{ name }}</a>
以及将下面代码<a href="http://creativecommons.org/licenses/{{ theme.creative_commons }}/4.0" class="cc-opacity" target="_blank">
修改成<a href="http://creativecommons.org/licenses/{{ theme.creative_commons }}/4.0" class="cc-opacity" target="_blank" rel="external nofollow">
#### 相关阅读(推荐)
SEO优化实战
原文链接: https://loremwalker.github.io/note/2018/02-26/5e7d6b37.html
相关文章推荐
- 基于Google排名因素对Drupal进行SEO优化
- 基于Google排名因素对Drupal进行SEO优化
- 基于Qt与OpenCV的图片读取、保存,并利用Canny进行简单的边缘处理结果显示
- 基于hive进行简单压缩技术测试
- 基于Hexo+Next主题的个人博客搭建定制优化
- 基于lame对mp3进行分割的简单实现
- 一只简单的网络爬虫(基于linux C/C++)————Url处理以及使用libevent进行DNS解析
- iOS开发中大部分App的网络数据交换是基于HTTP协议的。本文将简单介绍在Swift中使用HTTP进行网络请求的几种方法。
- 基于lame对mp3进行分割的简单实现
- 基于百度地图定位SDK进行简单的定位
- seo优化之Google和Baidu Ping服务实现快速收录文章的java,php代码实现
- seo优化之Google和Baidu Ping服务实现快速收录文章的java,php代码实现
- 基于lame对mp3进行分割的简单实现
- 搭建udp流(SPTS)并进行简单的收录
- 如何高效搭建基于Hexo和github技术的个人站点
- 对udp组播流(MPTS)进行简单的收录
- 一次简单完整的自动化登录测试-基于python+selenium进行cnblog的自动化登录测试
- Mac OS X搭建基于hexo的静态博客站点