最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How count the page views of my Octopress blog? - Stack Overflow

programmeradmin0浏览0评论

I would like to add a simple counter to my blog posts. That way, each blog post has its own counter and can display how many times the post was clicked.

How can I achieve that with Octopress? Any ideas?

Thanks in advance for any tips!

I would like to add a simple counter to my blog posts. That way, each blog post has its own counter and can display how many times the post was clicked.

How can I achieve that with Octopress? Any ideas?

Thanks in advance for any tips!

Share Improve this question asked Apr 11, 2013 at 20:10 TomTom 7352 gold badges9 silver badges13 bronze badges 1
  • 1 jekyll sites are static. What you are suggesting requires dynamism. – Alexander Ekdahl Commented Apr 11, 2013 at 23:23
Add a ment  | 

1 Answer 1

Reset to default 8

The best way in my opinion would be to setup Google Analytics on your blog by placing the Analytics code at the bottom of your _layouts/default.html file.

It won't allow others to see how many visits you have had per post, but you personally will be able to view that data and lots more.

For others to see also, you can use a third-party API that uses JavaScript. The third-party service tracks pageviews for you and then provides you with a JavaScript snippet that you paste your sidebar or where ever you want the pageviews to show up. StatCounter is an example (didn't verify if it is a good service or not).

This is a mon method of adding dynamic-ish features to static sites like those generated by Jekyll. Often people do this same technique to add ments to their blogs with Discus.

发布评论

评论列表(0)

  1. 暂无评论