New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If there is no posts, the function should return empty #9

Closed
huyingjie opened this Issue Feb 3, 2018 · 5 comments

Comments

Projects
None yet
2 participants
@huyingjie
Copy link

huyingjie commented Feb 3, 2018

I want to hide the text "Related Posts" if no posts are returned.

When there is no posts matched, popular_posts( {} , page ) returns

<ul class="popular-posts"><li class="popular-posts-item"><div class="popular-posts-title"><h3><a href="/untitled/" title="" rel="bookmark"></a></h3></div></li></ul>

It makes me impossible to write if statement to judge whether there exists at least related post or not.

I think popular_posts( {} , page ) should return empty string or any value equivalent to empty if no posts are related to the current post.

@tea3

This comment has been minimized.

Copy link
Owner

tea3 commented Feb 6, 2018

@huyingjie
Actually, this plugin have a more complicated problem. Sorry , I'll fix this problem someday . Please wait until update this plugin.

This problem can be temporarily avoided with the hexo clean command. And if you use cache , please delete cache file.

Also, you can judge freely in custom html. Please use popular_posts_json() tag.

@huyingjie

This comment has been minimized.

Copy link

huyingjie commented Feb 10, 2018

@tea3 hexo clean does not work.

@tea3

This comment has been minimized.

Copy link
Owner

tea3 commented Feb 12, 2018

@huyingjie I see . Which theme do you use ?

Also, could you avoid this issue temporarily with the popular_posts_json() tag ? This tag makes me possible to judge whether there exists posts .

@huyingjie

This comment has been minimized.

@tea3

This comment has been minimized.

Copy link
Owner

tea3 commented Feb 13, 2018

@huyingjie
Have you confirmed that the same problem will occur with default theme ?

@huyingjie huyingjie closed this Jun 18, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment