Skip to content

12CrazyPaul21/hexo-reading-count

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

安装插件

note:最好在 hexo-theme-next 主题下使用

npm install hexo-reading-count --save

配置

在全局 _config.yml 中修改,参数如下:

reading_count:
  enable: true
  count: '阅读次数'     # 自定义文本
  increase_url: <url> # 递增并获取单篇文章的阅读次数
  fetch_url: <url>    # 批量获取多篇文章的阅读次数

服务器接口

该插件使用文章发布时以秒为单位的时间戳作为标识(id),另外,还会用到文章的**标题(title)**用作可读的标识。

increase 是一个 post 接口,其请求和响应格式如下:

request(post):
	url: <url>
	form:
		id:<id>
		title:<title>
response(json): {"id":"<id>","pv":<pv>}

fetch 是一个 get 接口,其请求和响应格式如下:

request: https://<url>?ids=<id1>&ids=<id2>...
response(json): [{"id":"<id1>","pv":<pv1>},{"id":"<id2>","pv":<pv2>},...]

刷新服务

hexo clean
hexo generate
hexo server

About

hexo article reading count

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors