Fork me on GitHub

Hexo博客Next主题SEO优化

如何针对Hexo博客的Next主题做SEO优化,提升个人博客排名?

SEO概念

SEO
本文所有的优化主要是两方面:1、针对个人网站的页面排版进行SEO的优化,2、针对搜索引擎进行主动的优化

针对搜索引擎优化

添加sitemap

参考之前文章Hexo博客添加sitemap

添加蜘蛛协议robots

网站结构自身优化

出站链接添加nofollow标签

[nofollow]概述(https://baike.baidu.com/item/Nofollow/2410595?fr=aladdin)
Hexo的Next主题需要改以下几个地方:
1、footer.swig文件
目录位置:

1
$ ls -al your-hexo-site/themes/next/layout/_partials/footer.swig

修改方法:
修改以下两处a标签添加rel=”external nofollow”属性

1
2
{{ __('footer.powered', '<a class="theme-link" rel="external nofollow" href="https://hexo.io">Hexo</a>') }}
<a class="theme-link" rel="external nofollow" href="https://github.com/iissnan/hexo-theme-next">

2、sidebar.swig文件
文件位置:

1
$ ls -al your-hexo-site/themes/next/layout/_macro/sidebar.swig

修改方法:
修改以下一处a标签添加rel=”external nofollow”属性

1
<a rel="external nofollow" href="https://creativecommons.org/{% if theme.creative_commons === 'zero' %}publicdomain/zero/1.0{% else %}licenses/{{ theme.creative_commons }}/4.0{% endif %}/" class="cc-opacity" target="_blank">

添加keywords和description

在文章模板中scaffolds/post.md中添加如下代码,用于生成的文章中添加关键字和描述。

1
2
keywords:
description:

首页title优化

更改index.swig文件,文件路径是

your-hexo-site\themes\next\layout```,将下面代码
1
2
3
4
``` text
{% block title %} {{ config.title }} {% endblock %}
改成
{% block title %} {{ config.title }} - {{ theme.description }} {% endblock %}

修改文章链接

参考之前的文章Hexo之URL持久化

======================================================
希望各位朋友支持一下

本文作者:dongsheng
本文地址https://mds1455975151.github.io/archives/91c0d0bf.html
版权声明:转载请注明出处!

坚持技术分享,您的支持将鼓励我继续创作!