Closed Dalker closed 2 months ago
Hi Daniel!
Thanks for reporting this bug.
Would you be interested in creating a PR for the fix?
Hello Óscar and first of all thanks for making your great theme publicly available!
I'd be happy to contribute if I can manage to sort out a general solution, but it doesn't seem to be so simple (for my personal use I just did a quickfix replacing one hard-coded section name by another).
The difficulty is that the list_posts
macro must be made aware of the target section, e.g. passed as an extra argument, ~but some of its callers do not seem to have that information available, notably tags/single.html
-- or at least not simply by the name section
~ (I'm new to zola so I might be missing something here).
EDIT: never mind, I figured out how to fix at least the specific problem in a somewhat general way; will send a pull request a bit later when I get the time to tidy it up
Thanks for the report and the fix!
Bug Report
Environment
Zola version: 0.18.0 tabi version or commit: d0dd37ef1e16dc1ed5171f7c6b99ec2d18ffeafa
Expected Behavior
When
section_path
in the[extra]
section of front-matter of main content_index.md
is set, it should be used to generate the list of posts visible in the main (first) page of the site. If, furthermore,max_posts = 1
is set, the "All posts ->" link that is then generated below the single post (the last post) visible on the main page should also point to the same section chosen withsection_path
Current Behavior
If
max_posts
is greater than or equal to 2, everything works fine. Withmax_posts = 1
, "All posts ->" points to a possibly non-existing "blog" section.A little investigation shows that the issue comes from the templates/macros/list_posts.html file, where
"blog"
is hard-coded, instead of using thesection_path
chosen by the user.Step to Reproduce
Place the following in
content/_index.md
for a site in which there is noblog
subdirectory (aka section):