You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Which is obviously expected to be able to handle the situation when there are no posts.
However, when the plugin returns no posts, the else block is not executed. In fact, it appears that the template is not called at all when no posts are returned.
This is because of these lines in post_list.py, at around lines 221-222:
ifnotposts:
return'', []
It seems that because the empty values are returned, processing is not passed to the template. Removing those lines fixes the problem and allows the template's else clause to work.
I can't see that this change breaks anything else, so I'll submit a pull request for it, unless someone has an objection.
The text was updated successfully, but these errors were encountered:
Environment
Python Version:
3.7.8
Nikola Version:
8.1.1
Operating System:
Mac OS Catalina (10.15.5) / Ubuntu 19.10
Description:
In the default template for the
post-list
plugin, namelypost_list_directive.tmpl
Which suggests that there is some possibility that the template will be called with no posts.
While in
list_post.tmpl
, which you can also use withpost-list
, we have this:Which is obviously expected to be able to handle the situation when there are no posts.
However, when the plugin returns no posts, the
else
block is not executed. In fact, it appears that the template is not called at all when no posts are returned.This is because of these lines in
post_list.py
, at around lines 221-222:It seems that because the empty values are returned, processing is not passed to the template. Removing those lines fixes the problem and allows the template's
else
clause to work.I can't see that this change breaks anything else, so I'll submit a pull request for it, unless someone has an objection.
The text was updated successfully, but these errors were encountered: