码迷,mamicode.com
首页 > 其他好文 > 详细

NexT 个性化设置

时间:2018-04-17 00:03:06      阅读:721      评论:0      收藏:0      [点我收藏+]

标签:google   config   lib   initial   common   infinite   layout   bit   name   

NexT 主题添加分类页面

新建页面

在本地使用终端 cdblog 文件夹下,执行如下命令:

$ cd Documents/blog
$ hexo new page categories

设置页面

编辑 source/categories/index.md

---
title: categories
date: 2018-04-09 13:15:42
type: "categories"
layout: "categories"
comments: false
---

修改主题配置文件

编辑 themes/next/_config.yml

menu:
  home: / || home
  #about: /about/ || user
  #tags: /tags/ || tags
  archives: /archives/ || archive
  categories: /categories/ || th

然后,终端重新部署即可生效。

NexT 主题打赏

准备支付宝和微信二维码

  • 支付宝生成二维码地址

  • 微信生成二维码教程地址

配置本地站点文件

blog/themes/next/_config.yml :

# Reward
reward_comment: 碎银打赏,以资鼓励!
wechatpay: /images/wechatpay.jpg
alipay: /images/alipay.jpg
#bitcoin: /images/bitcoin.png

注:wechatpay.jpg、alipay.jpg 图片放入 themes/next/source/images 中,像素修改为:215 * 215。

修复煽动 Bug

修改next/source/css/_common/components/post/post-reward.styl,注释wechat:hoveralipay:hover

/*
#wechat:hover p{
    animation: roll 0.1s infinite linear;
    -webkit-animation: roll 0.1s infinite linear;
    -moz-animation: roll 0.1s infinite linear;
}
#alipay:hover p{
    animation: roll 0.1s infinite linear;
    -webkit-animation: roll 0.1s infinite linear;
    -moz-animation: roll 0.1s infinite linear;
}
*/

然后,终端重新部署即可生效。

NexT 开启数学公式

修改主题配置文件 themes/next/_config.yml 中:

math:
  enable: true

书写markdown博文时:

---
title: 
date: 
tags:
categories: 
mathjax: true
---

Google SEO

我搭建的博客为什么在 百度 or Google 搜不到?那是因为你没有做 SEO

Google Webmaster tools

Google Webmaster tools

  1. 获取 google site verification code

登录 Google Webmaster Tools,导航到验证方法,并选择 HTML Tag。将会获取到一段代码:

html <meta name="google-site-verification" content="XXXXXXXXXXXXXXXXXXXXXXX" />

  1. Google Search Console 时,选用 Alternate methods 的 HTML tag 认证时,copy 自己的meta name

themes/next/layout/_partials/head.swig 文件中:

html <meta charset="UTF-8"/> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/> <meta name="theme-color" content="{{ theme.android_chrome_color }}">

修改为:

html <meta charset="UTF-8"/> <meta name="google-site-verification" content="g6QpXDSwHd_3Rf0YwOUxXI9VYbudBNrpF5C91z-dBc0" /> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/> <meta name="theme-color" content="{{ theme.android_chrome_color }}">

即在第二行添加自己的meta name

html <meta name="google-site-verification" content="g6QpXDSwHd_3Rf0YwOUxXI9VYbudBNrpF5C91z-dBc0" />

  1. 进入本地安装hexo的目录下,我的是blog。首先安装 sitmap ,执行命令:

bash $ npm install hexo-generator-sitemap --save

打开站点配置文件 blog/_config.yml ,添加

bash sitemap: path: sitemap.xml

OK,搞定了。这样在执行 hexo g 编译时,会在目录 /blog/public/ 下,生成 sitemap.xml 文件。该文件是提供给搜索爬虫用的。

过后,就可在 Google 搜到自己博客的相关信息了。

添加蜘蛛协议 robots.txt

添加文blog/source/robots.txt

User-agent: *
Disallow: /CNAME
Disallow: /README
Disallow: /css/
Disallow: /images/
Disallow: /js/
Disallow: /lib/

Allow: /
Allow: /archives
Allow: /categories

Sitemap: narisu.coding.me/sitemap.xml

?

NexT 个性化设置

标签:google   config   lib   initial   common   infinite   layout   bit   name   

原文地址:https://www.cnblogs.com/narisu/p/8859018.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!