hexo站点地图
将网站链接提交到百度
百度搜索引擎提交入口
有三种验证方式,我选择Html标签验证
,在themes\next\layout\_partials\head.swing
中添加验证代码:
<meta name="baidu-site-verification" content="s8Pe1TBqyy" />
然后点击完成验证,通过即可。同理将站点链接也提交到Google和搜狗,此处不表。
给站点添加sitemap
1、 Hexo安装sitemap
npm install hexo-generator-sitemap --save #sitemap.xml适合提交给谷歌搜素引擎
npm install hexo-generator-baidu-sitemap --save #baidusitemap.xml适合提交百度搜索引擎
2、 在站点配置文件_config.yml
中添加以下代码
# 自动生成sitemap
sitemap:
path: sitemap.xml
baidusitemap:
path: baidusitemap.xml
3、 修改站点配置文件_config.yml
# URL
## If your site is put in a subdirectory, set url as 'http://yoursite.com/child' and root as '/child/'
url: http://yoursite
4、 Hexo编译
hexo clean
hexo g
会/public目录下生成sitemap.xml
和baidusitemap.xml
,这就是你的站点地图。
5、 提交sitemap到站长平台
百度站长平台sitemap提交是邀请制的,并没有对所有站长开放,只有网站到一定等级百度才会在你后台开放提交sitemap的入口。
添加蜘蛛协议robots.txt
1、 新建robots.txt文件,添加以下文件内容,把robots.txt放在hexo站点的source文件下。
# hexo robots.txt
User-agent: *
Allow: /
Allow: /archives/
Disallow: /vendors/
Disallow: /js/
Disallow: /css/
Disallow: /fonts/
Disallow: /vendors/
Disallow: /fancybox/
Sitemap: http://www.zaoanx.com/sitemap.xml
Sitemap: http://www.zaoanx.com/baidusitemap.xml
2、 在百度站长平台监测并更新Robots
提示检测到您更新了Robots文件
即成功。
给出站链接添加 “nofollow” 标签
nofollow标签是由谷歌领头创新的一个“反垃圾链接”的标签,并被百度、yahoo等各大搜索引擎广泛支持,引用nofollow标签的目的是:用于指示搜索引擎不要追踪(即抓取)网页上的带有nofollow属性的任何出站链接,以减少垃圾链接的分散网站权重。
以hexo的NexT主题为例,需要修改两处
1、 找到footer.swig
,路径在your-hexo-site\themes\next\layout\_partials
,将下面代码
{{ __('footer.powered', '<a class="theme-link" href="http://hexo.io">Hexo</a>') }}
- 1
改成
{{ __('footer.powered', '<a class="theme-link" href="http://hexo.io" rel="external nofollow">Hexo</a>') }}
- 1
将下面代码
<a class="theme-link" href="https://github.com/iissnan/hexo-theme-next">
- 1
改成
<a class="theme-link" href="https://github.com/iissnan/hexo-theme-next" rel="external nofollow">
- 1
2、 修改sidebar.swig文件,路径在your-hexo-site\themes\next\layout_macro,将下面代码
<a href="{{ link }}" target="_blank">{{ name }}</a>
- 1
改成
<a href="{{ link }}" target="_blank" rel="external nofollow">{{ name }}</a>
- 1
将下面代码
<a href="http://creativecommons.org/licenses/{{ theme.creative_commons }}/4.0" class="cc-opacity" target="_blank">
- 1
改成
<a href="http://creativecommons.org/licenses/{{ theme.creative_commons }}/4.0" class="cc-opacity" target="_blank" rel="external nofollow">
- 1
可以使用chinaz站长工具进行各项检测。
keywords 和 description
在\scaffolds\post.md
中添加如下代码,用于生成的文章中添加关键字和描述。
keywords:
description:
- 1
- 2
在\themes\next\layout\_partials\head.swig
有如下代码,用于生成文章的keywords。暂时还没找到生成description的位置。
{% if page.keywords %}
<meta name="keywords" content="{{ page.keywords }}" />
{% elif page.tags and page.tags.length %}
<meta name="keywords" content="{% for tag in page.tags %}{{ tag.name }},{% endfor %}" />
{% elif theme.keywords %}
<meta name="keywords" content="{{ theme.keywords }}" />
{% endif %}
- 1
- 2
- 3
- 4
- 5
- 6
- 7
然后在\themes\next\layout\_macro\post.swig
中找到这个位置:
{% if post.description %}
- 1
将以下代码去掉:
{% if post.description %}
{{ post.description }}
<div class="post-more-link text-center">
<a class="btn" href="{{ url_for(post.path) }}">
{{ __('post.read_more') }} »
</a>
</div>
- 1
- 2
- 3
- 4
- 5
- 6
- 7
否则首页的文章摘要就会变成文章的description
。
首页title的优化
更改index.swig
文件,文件路径是your-hexo-site\themes\next\layout
,将下面代码
{% block title %} {{ config.title }} {% endblock %}
- 1
改成
{% block title %} {{ config.title }} - {{ theme.description }} {% endblock %}
- 1
这时候你的首页标题会更符合网站名称 - 网站描述这习惯。
修改文章链接
HEXO默认的文章链接形式为domain/year/month/day/postname
,默认就是一个四级url,并且可能造成url过长,对搜索引擎是十分不友好的,我们可以改成 domain/postname
的形式。编辑站点_config.yml
文件,修改其中的permalink
字段改为permalink: :title.html
即可。
hexo站点地图的更多相关文章
- Hexo优化 | 创建sitemap站点地图并向Google提交
前言 站点地图是一种文件,您可以通过该文件列出您网站上的网页,从而将您网站内容的组织架构告知Google和其他搜索引擎.Sitemap 可方便管理员通知搜索引擎他们网站上有哪些可供抓取的网页.搜索引擎 ...
- [.NET领域驱动设计实战系列]专题九:DDD案例:网上书店AOP和站点地图的实现
一.引言 在前面一专题介绍到,要让缓存生效还需要实现对AOP(面向切面编程)的支持.所以本专题将介绍了网上书店案例中AOP的实现.关于AOP的概念,大家可以参考文章:http://www.cnblog ...
- 爱上MVC3系列~开发一个站点地图(俗称面包屑)
回到目录 原来早在webform控件时代就有了SiteMap这个东西,而进行MVC时代后,我们也希望有这样一个东西,它为我们提供了不少方便,如很方便的实现页面导航的内容修改,页面导航的样式换肤等. 我 ...
- 使用windows服务更新站点地图
由于公司平台访问人数逐渐增多,公司项目的数据库已经几次出现宕机现象.为减轻数据库压力,我上个月对公司项目做了下调整.把新闻板块提取出来单独一个站点,单独一个数据库.减少了主站点和数据库的负担和压力. ...
- 分享一个在线生成站点地图SiteMap制作工具
站点地图SiteMap的好处是很大的,对Seo很有好处,能够更方便.迅速的让搜索引擎收录.WordPress 有不少生成Google Sitemap 的工具,但是有些只是针对WordPress的系统的 ...
- php生成百度站点地图sitemap.xml
<?php header("Content-type:text/html;charset=utf-8"); //php生成百度站点地图sitemap.xml //http:/ ...
- MVC小系列(十九)【mvc与站点地图】
我的MvcSiteMap地图主要由实体文件,XML配置文件,C#调用文件组成,当然为了前台调用方法,可以为HtmlHelper添加一个扩展方法 第一步 定义站点地图实体 public class Mv ...
- 关于ASP.NET 中站点地图sitemap 的使用
在ASP.NET MVC 如此火热的时期,我竟然不适时宜的谈起ASP.NET ,恐怕会引来一阵嘲笑.最为无趣的是,讲解的竟然还是其中的一个控件.oh~~ my god!my out! ^_^ Si ...
- Mvc中使用MvcSiteMapProvider实现站点地图之基础篇
MvcSiteMapProvider 是针对 ASP.NET MVC 中,提供菜单. 网站地图. 站点地图路径功能,以及更多的工具.它提供配置使用一个可插入的体系结构,可以是 XML. 数据库或动态生 ...
随机推荐
- 表单验证实现React-router跳转
方法一:broserHistory.push handleSubmit(e){ e.preventDefault(); const path = '/demo'; broserHistory.push ...
- PHP:(一)安装并使用PHP
php的安装分为两个部分:环境安装配置和开发工具 一.集成环境安装配置 (一)安装 选择:wampserver或者xampp 我采用的是xampp. 在http://www.sourceforce.n ...
- jquery 筛选元素 (3)
.addBack() 添加堆栈中元素集合到当前集合中,一个选择性的过滤选择器. .addBack([selector]) selector 一个字符串,其中包括一个选择器表达式,匹配当前元素集合,不包 ...
- LeetCode705. Design HashSet
题目 不使用任何内建的哈希表库设计一个哈希集合 具体地说,你的设计应该包含以下的功能 add(value):向哈希集合中插入一个值. contains(value) :返回哈希集合中是否存在这个值. ...
- poj_2689_Prime Distance
The branch of mathematics called number theory is about properties of numbers. One of the areas that ...
- OA上传和编辑数据
1.VO:value object值对象.通常用于业务层之间的数据传递,和PO一样也是仅仅包含数据而已.但应是抽象出的业务对象,可以和表对应,也可以不,这根据业务的需要. 2. String[]类型打 ...
- Linux段式管理与页式管理
内存管理有2种机制:1.段式管理:2.页式管理 在80386CPU中增加了2个寄存器:1.全局性的段描述表寄存器GDTR 2.局部性的段描述表寄存器LDTR 段寄存器的高13位用于在全局或局部描述表项 ...
- python+scrapy环境搭建步骤描述
Python3(3.5.4)搭建爬虫系统步骤描述: 1.下载python安装包,路径:https://www.python.org/downloads/windows/ 选择3.5.4版本64位的安 ...
- linxu信号种类
使用kill -l 命令,可看到linux支持的信号列表: 1) SIGHUP 2) SIGINT 3) SIGQUIT 4) SIGILL 5) SIGTRAP 6) SIGABRT 7) SIGB ...
- Triangular Sums 南阳acm122
Triangular Sums 时间限制:3000 ms | 内存限制:65535 KB 难度:2 描述 The nth Triangular number, T(n) = 1 + … + n ...