[Hexo] My Hexo Setting

Hexo

Required: nodejs and npm

1
npm install hexo-cli -g

Uexo Command Usage

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
Usage: hexo <command>

Commands:
clean Remove generated files and cache.
config Get or set configurations.
deploy Deploy your website.
generate Generate static files.
help Get help on a command.
init Create a new Hexo folder.
list List the information of the site
migrate Migrate your site from other system to Hexo.
new Create a new post.
publish Moves a draft post from _drafts to _posts folder.
render Render files with renderer plugins.
server Start the server.
version Display version information.

Page - Markdown

Markdown Cheat Sheet

1
2
3
4
5
6
7
# Add tags, categories, and about pages
hexo new page tags
hexo new page categories
hexo new page about

# New a post
hexo new "Post Name"

Post Header

1
2
3
4
5
6
title: My Hexo Note
date: 2021-06-12 01:53:11
categories: hexo
tags: hexo

<!-- more -->

Hexo Theme - NexT

1
git clone https://github.com/theme-next/hexo-theme-next themes/next

NexT Config - themes/next/_config.yml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
minify: true
pjax: true
scheme: Gemini
darkmode: auto

copy_button:
enable: true
# Show text copy result.
show_result: true
# Available values: default | flat | mac
style: mac

mediumzoom: true

busuanzi_count:
enable: false
enable: true

Google Analytics

1
2
google_analytics:
tracking_id: # <app_id>

Disqus Comment

Login and Setup a Disqus Account: https://disqus.com/

1
2
3
4
# Disqus
disqus:
enable: true
shortname: ranger-chans-blog

Hexo Plugins

GitHub Deployer

1
npm install hexo-deployer-git --save

_config.yml

1
2
3
4
5
6
7
8
9
url: https://rangerz.github.io/blog

# Deployment
## Docs: https://hexo.io/docs/one-command-deployment
deploy:
type: git
repo: git@github.com:rangerz/blog.git
branch: github-pages
message: Update blog at {{ now('YYYY-MM-DD HH:mm:ss') }}
  • Deploy GitHub Command
1
hexo deploy

Sitemap

1
npm install hexo-generator-sitemap --save

_config.yml

1
2
sitemap:
path: sitemap.xml

RSS Feed

1
npm install hexo-generator-feed --save

_config.yml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# RSS Feed
## Docs: https://github.com/hexojs/hexo-generator-feed
feed:
enable: true
type: atom
path: atom.xml
limit: 20
hub:
content:
content_limit: 140
content_limit_delim: ' '
order_by: -date
icon: icon.png
autodiscovery: true
template:

themes/next/_config.yml

1
rss: /atom.xml

themes/next/layout/_partials/sidebar/site-overview.swig

1
2
3
4
5
6
7
8
{% if theme.rss %}
<div class="feed-link motion-element">
<a href="{{ url_for(theme.rss) }}" rel="alternate">
<i class="fa fa-rss"></i>
RSS
</a>
</div>
{% endif %}

nofollow

1
npm install hexo-autonofollow --save

_config.yml

1
2
nofollow:
enable: true

lazyload-image

1
npm install hexo-lazyload-image --save

_config.yaml

1
2
3
lazyload:
enable: true
onlypost: false

https://search.google.com/search-console/welcome

Input URL Prefix: https://rangerz.github.io/blog/

themes/next/layout/_partials/head/head.swig

1
<meta name="google-site-verification" content="aODVh6Swyz72uqikurLQBpNIqJO68gqxnPpEc2Pm9kI" />
1
npm install hexo-abbrlink --save

_config.yaml

1
2
3
4
5
permalink: posts/:abbrlink/

abbrlink:
alg: crc32
rep: hex

Search DB

1
npm install hexo-generator-searchdb --save

_config.yaml

1
2
3
4
5
search:
path: search.xml
field: post
content: true
format: html

themes/next/_config.yml

1
2
local_search:
enable: true

robots.txt

Add file: source/robots.txt

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# robots.txt for https://rangerz.github.io/blog/

User-agent: *

Allow: /
Allow: /about/
Allow: /archives/
Allow: /categories/
Allow: /tags/

Disallow: /images/
Disallow: /js/
Disallow: /css/
Disallow: /lib/

Sitemap: https://rangerz.github.io/blog/search.xml
Sitemap: https://rangerz.github.io/blog/sitemap.xml