Additional Configurations for Hexo
Flu

I added gitalk comment system and read counts. However the gitalk did not work properly. I post this only for testing purposes. All you need to do is clicking save after modifying any config file. There is not need to git add or git commit if you only want to update your config.

Add a new theme

You can look for your theme on https://hexo.io/themes/ . If you click any link on that page, it will direct you to a github repository. You will always find instructions of how to install the theme on README.md. I prefer git clone way.

Take theme keep as an example:

1
2
$ cd themes
$ git clone git@github.com:XPoet/hexo-theme-keep.git keep

You will see

Cloning into ‘keep’…
remote: Enumerating objects: 4592, done.
remote: Counting objects: 100% (321/321), done.
remote: Compressing objects: 100% (170/170), done.
remote: Total 4592 (delta 162), reused 248 (delta 147), pack-reused 4271
Receiving objects: 100% (4592/4592), 2.73 MiB | 3.84 MiB/s, done.
Resolving deltas: 100% (2971/2971), done.

Check your _config.yml in you root blog folder and set theme variable to keep

1
2
3
4
# Extensions
## Plugins: https://hexo.io/plugins/
## Themes: https://hexo.io/themes/
theme: keep

Re-generate your folder to check your new theme.

1
2
3
> hexo clean
> hexo generate
> hexo server

If you want to update your keep theme to its latest version

1
2
3
$ cd themes/keep
$ git fetch
$ git pull

Add read counts

Open _config.yml in your themes folder, for example themes/keep/_config.yml. Set busuanzi parameters to true.

1
2
3
4
5
busuanzi_count:
enable: true
site_uv: true
site_pv: true
page_pv: true

Add gitalk

It does not work properly at the beginning, but if you wait long enough, it will work.

Request a GitHub OAuth application via the link https://github.com/settings/applications/new . When you register a new application, set this information.

Application name: website_comments
Homepage URL: [your_personal_link_or_github.io_link]
Authorization callback URL: [your_blog_github.io_link]
Now you have Client ID and Client secrets.

Create a new GitHub repository website_comments to save the comments for the website. Make sure the repository is public and ✔issues.

Create a new issue.

Open _config.yml in your themes folder. gitalk settings in keep is like this

1
2
3
4
5
6
7
8
9
10
comment:
enable: true
use: gitalk # values: valine | gitalk | twikoo
# Gitalk
# See: https://github.com/gitalk/gitalk
gitalk:
github_id: [your_id] # GitHub repo owner
repository: website_comments # Repository name to store issues
client_id: [your_client_id] # GitHub Application Client ID
client_secret: [your_client_secret] # GitHub Application Client Secret

The _config.yml files of other themes are similar. The gitalk settings in theme next are like this

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# Gitalk
# For more information: https://gitalk.github.io
gitalk:
enable: true
github_id: [your_id] # GitHub repo owner
repo: website_comments # Repository name to store issues
client_id: [your_client_id] # GitHub Application Client ID
client_secret: [your_client_secret] # GitHub Application Client Secret
admin_user: [your_id] # GitHub repo owner and collaborators, only these guys can initialize gitHub issues
distraction_free_mode: true # Facebook-like distraction free mode
# When the official proxy is not available, you can change it to your own proxy address
proxy: https://cors-anywhere.azm.workers.dev/https://github.com/login/oauth/access_token # This is official proxy address
# Gitalk's display language depends on user's browser or system environment
# If you want everyone visiting your site to see a uniform language, you can set a force language value
# Available values: en | es-ES | fr | ru | zh-CN | zh-TW
language:

Read ‘_config.yml’ and README.md file, you will eventually know what to do. Cheers.

References

https://gary5496.github.io/2018/03/hexo-github-setup/

 Comments