tea3 / hexo-related-popular-posts

A hexo plugin that generates a list of links to related posts and popular posts. Also , this plugin can get Visitor Counts (PV) on posts.
MIT License
109 stars 14 forks source link

Can't generate url correctly when site is in a subdirectory #14

Closed StardustDL closed 5 years ago

StardustDL commented 5 years ago

Description

Thanks for your plugin.

I put the hexo site in a subdirectory (you can see that in my site _config.yml below), and this plugin generated post path without subdirectory.

For example, the subdirectory name is "test". And there is a post at _post/hello.md, which url will be /test/hello/, but in this plugin, it will generate url /hello/ for this post and accessing this link will get Not Found.

Maybe add config.root to post path?

BTW, I use NEXT theme.

Environment Info

Site _config.yml

url: https://localhost:4000/test
root: /test/

Theme _config.yml

# Related popular posts
# Dependencies: https://github.com/tea3/hexo-related-popular-posts
related_posts:
  enable: true
  title: # custom header, leave empty to use the default one
  display_in_home: false
  params:
    maxCount: 5
    #PPMixingRate: 0.0
    #isDate: false
    #isImage: false
    #isExcerpt: false

Plugin version(npm ls --depth 0)

+-- hexo@3.7.1
+-- hexo-deployer-git@0.3.1
+-- hexo-generator-archive@0.1.5
+-- hexo-generator-category@0.1.3
+-- hexo-generator-feed@1.2.2
+-- hexo-generator-index@0.2.1
+-- hexo-generator-searchdb@1.0.8
+-- hexo-generator-sitemap@1.2.0
+-- hexo-generator-tag@0.2.0
+-- hexo-related-popular-posts@3.0.2
+-- hexo-renderer-ejs@0.3.1
+-- hexo-renderer-markdown-it-plus@1.0.4
+-- hexo-renderer-stylus@0.3.3
+-- hexo-server@0.2.2
`-- hexo-symbols-count-time@0.4.4
tea3 commented 5 years ago

@StardustDL Thank you for notifying about issue. This is a bug due to the generation path.

I will update the npm version later, so please wait.

tea3 commented 5 years ago

@StardustDL I updated package , please use new version.

StardustDL commented 5 years ago

@tea3 I just updated it, and it works! Thank you.