Hexo search engine optimization

HEXO - search engine optimization(SEO)

How can I make my blog search on various search sites?

After you create a blog, you need to proceed with optimization to expose your blog to the search engine.

Installing the plug-in required for search engine optimization (SEO)
  • hexo-auto-canonical
  • hexo-generator-robotstxt
  • hexo-autonofollow
  • hexo-generator-feed
  • hexo-generator-seo-friendly-sitemap
1. hexo-auto-canonical

A plug-in that automatically makes a representative URL (standard link).

1
npm install --save hexo-auto-canonical

Install the module through git as shown above.
After installation, in the path of the blog (based on the main directory), Insert the code below <%- meta(page) %> in the ejs file that is themes > hueman > layout > common > head.ejs.

1
2
3
4
5
//.ejs
<%- autoCanonical(config, page) %>

//.jade
| !{ autoCanonical(config, page) }

If inserted, the code will be as below.

1
2
<%- meta(page) %>
<%- autoCanonical(config, page) %>
2. hexo-generator-robotstxt

This plug-in automatically makes the robot.txt file.

1
npm install hexo-generator-robotstxt --save

Install the module through git as shown above.
After installation, open the _config.yml (not the theme _config.yml) file in the blog directory and input it as below.

1
2
3
4
5
robotstxt:
useragent: "*"
allow:
- /
sitemap: https://username.github.io/sitemap.xml
3. hexo-autonofollow

A plug-in that automatically adds rel="external noofollow" properties to external links.

1
npm install hexo-autonofollow --save

Install the module through git as shown above.
After installation, open the _config.yml (not the theme _config.yml) file in the blog directory and input it as below.

1
2
3
4
5
nofollow:
enable: true //Plug-in enabled or disabled
exclude: //host to exclude
- guest1.com
- guest2.com
4. hexo-generator-feed

This plug-in automatically makes RSS feed.

1
npm install hexo-generator-feed --save

Install the module through git as shown above.
After installation, open the _config.yml (not the theme _config.yml) file in the blog directory and input it as below.

1
2
3
4
feed:
type: rss2 //feed의 종류(atom/rss2) * I recommend to write rss2
path: rss2.xml //Path where feed will be generated
limit: 20 //Set the latest number of posts (0 or false is the entire post)
5. hexo-generator-seo-friendly-sitemap

Automatically creates site map xml files for crawlers to crawl blogs more efficiently.

1
npm install hexo-generator-seo-friendly-sitemap --save

Install the module through git as shown above.
After installation, open the _config.yml (not the theme _config.yml) file in the blog directory and input it as below.

1
2
3
4
sitemap:
path: sitemap.xml //Path where sitemap will be generated
tag: false //whether the tag is included in the sitemap
category: false //Whether to include a category in sitemap

Adding all, _config.yml file will be completed as follows.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
...
# URL
## If your site is put in a subdirectory, set url as 'http://example.com/child' and root as '/child/'
url: https://username.github.io
//url : https://github.com/username/username.github.io
=> If you enter this (reportory address, not blog address), be careful because rss2.xml does not read the file path properly!
...
# Deployment
## Docs: https://hexo.io/docs/one-command-deployment
deploy:
type: git
repo: https://github.com/username/username.github.io # Repository address where the GitHub page is stored
branch: main
nofollow:
enable: true
feed:
type: rss2
path: rss2.xml
limit: 20
#sitemap auto generator
sitemap:
path: sitemap.xml
tag: false
category: false
robotstxt:
useragent: "*"
allow:
- /
sitemap: https://username.github.io/sitemap.xml
Share