Hexo blog adds article reading statistics and comment functions

Teach you to use hexo to build a personal blog that is completely free on github page from scratch

1. Increase the number of article reading statistics function

1. Register a LeanClound account
2. Create an application

3. Obtain the APP ID and APP Key, and then configure them in the configuration file.

4. Create Class

In the data configuration interface of the application, the underscores on the left start with the tables predefined by the system. In order to facilitate the distinction, we create a new table to save our data.
The new class is used to save data such as the number of visits to our blog articles. Theoretically, the name can be named arbitrarily, as long as you make the corresponding changes to the interactive code, but in order to ensure compatibility with the modification of the NexT theme, here is the new class The name must be Counter:

5. Add a secure domain name

After adding secure domain names, only these secure domain names have the right to access back-end data, which can further enhance security.

6. Modify the theme configuration file

Modify the configuration file next/_config.yml

leancloud_visitors:
  enable: true
  app_id: #你的app_id
  app_key: #你的的app_key

7. Effect

You can see the number of visits in hexo

Data can also be viewed in LeanCloud:

2. Add article comment function

1. Register an account

Log in to will force the official website , the registered account

2. Laibili provides three versions:

  • LiveRe paid version
  • City Free Edition
  • Premium version

Choose according to the situation of the person, here is the free version, and then in the upper right corner: Avatar-"Management page-"Code management-"General website to view the production code, here will use date-uid

3. Configure Livere Statistics

Modification: Under the project-"themes->next (please check your own theme) ->_config.yml, open livere_uid, and fill in the uid generated by Laibli

livere_uid: 你的uid

4. View comment function

As follows: log in with QQ

5. Other settings

Count the number of comments, comment accounts, shares, etc.

3. Official account

Welcome to pay attention to the official account: Limu Ke

Guess you like

Origin blog.csdn.net/qq_41941875/article/details/112465503