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

Feature-Request about list.img #29

Closed xaoxuu closed 3 years ago

xaoxuu commented 3 years ago

Hello, I found that the img obtained by hexo-related-popular-posts can only be automatically read from within the article. May I ask you to add a configuration item according to one of the front-matter How about a custom value such as headimg as the summary image of the article?

For example, in "Article 1", the header image of "Article 2" is not perfect. What we want is A, but actually B:

iShot2020-08-26δΈ‹εˆ06 02 30 iShot2020-08-26δΈ‹εˆ06 03 57

tea3 commented 3 years ago

@xaoxuu Please specify eyeCatchImage and description in frontmatter of markdown file. It is explained in detail issue #13.

Please see the follow about frontmatter. https://github.com/tea3/hexo-related-popular-posts/wiki/More-Settings#customize-html

xaoxuu commented 3 years ago

Can I change the eyeCatchImage attribute in the blog's _config.yml ? Because the theme already uses other attributes, I have to duplicate the image link.

headimg: https://gitee.com/xaoxuu/cdn-assets/raw/master/blog/2019-0827a@2x.jpg
eyeCatchImage: https://gitee.com/xaoxuu/cdn-assets/raw/master/blog/2019-0827a@2x.jpg

This attribute may be different in different themes, such as header_img: or cover_img: ...

It would be great if it can be customized. 😁

tea3 commented 3 years ago

@xaoxuu I'm sorry. It cannot be specified in _config.xml. This attribute is a value specified for each article.

https://github.com/tea3/hexo-related-popular-posts/issues/13#issuecomment-430496487

xaoxuu commented 3 years ago

What I mean is, allow users to change eyeCatchImage to other attribute names to suit the user's hexo theme, for example:

Edit in blog/_config.yml:

popularPosts:
  eyeCatchImageAttributeName: themeHeaderImage

So users can write in front-matter like this:

---
title: xxx
themeHeaderImage: https://xxx.png
---

Instead of having to write both:

---
title: xxx
themeHeaderImage: https://xxx.png
eyeCatchImage: https://xxx.png
---
tea3 commented 3 years ago

@xaoxuu I see. Actually , this plugin supports the postImage and ampSettings attributes in addition to eyeCatchImage. Can't be customized, but can these attributes use? https://github.com/tea3/hexo-related-popular-posts/blob/5f782be6d13008eedd862049689df0a014dbfdb3/lib/collector.js#L50

xaoxuu commented 3 years ago

I submitted a pr about this, you can see if it works.

tea3 commented 3 years ago

@xaoxuu Thank you for suggestion. I want to merge tonight or tomorrow. Please wait for πŸ™πŸ»

xaoxuu commented 3 years ago

Thank you 🀝