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
While I was playing with the series feature, I found something which should work (from my perspective at least) but doesn't.
In each of my series' articles, I would like to add some link between the article.
I would like to add an intro like We've seen ... in the previous article of this series and now, we'll see ... for all articles except the first one (because there is no previous article).
I would like to add an outro like We')ve just seen ..., and we'll see ... in the next article of this series. for all articles except the last one (because there is no next article.
Previous and next article point to the relevant previous or next article with a link (which is easy to configure thanks to the template variables).
So far, we have following templates:
next_only - Used for the first article (has next article but no previous)
middle - Used for articles with both previous and next articles
prev_only - Used for the last article (has previous article but no next)
default - Fallback template used when a specific position template isn’t defined
In order to achieve what I want, I would need to configure middle and prev_only for intro and middle and next_only for outro.
This works if I have multiple articles but fails if I have only one, because the only article is both a next_only and a prev_only.
From my configuration, it inherits the two links which are broken because there is neither a previous article nor a next one.
I discovered that because all the articles of my series are currently draft except the first one.
Running zola serve -drafts works as expected but running zola serve has the bad behavior.
I know I could just wait to have multiple articles before commiting my code but all of this made me think we may be missing some templates
We could add a has_prev and a has_next templates.
In terms of precedence, I would go for: next_only/middle/prev_only > has_prev/has_next > default.
I would be happy to get your thoughts about that.
I could have a look at implementing it if you think it is worth it.
Edit: I removed renaming of next_only and prev_only (into first, last) after looking at the code.
We should keep next_only and prev_only for retro-compatibility but I would deprecate them in favor of first and last.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello,
While I was playing with the series feature, I found something which should work (from my perspective at least) but doesn't.
In each of my series' articles, I would like to add some link between the article.
I would like to add an intro like
We've seen ... in the previous article of this series and now, we'll see ...
for all articles except the first one (because there is no previous article).I would like to add an outro like
We')ve just seen ..., and we'll see ... in the next article of this series.
for all articles except the last one (because there is no next article.Previous and next article point to the relevant previous or next article with a link (which is easy to configure thanks to the template variables).
So far, we have following templates:
next_only
- Used for the first article (has next article but no previous)middle
- Used for articles with both previous and next articlesprev_only
- Used for the last article (has previous article but no next)default
- Fallback template used when a specific position template isn’t definedIn order to achieve what I want, I would need to configure
middle
andprev_only
for intro andmiddle
andnext_only
for outro.This works if I have multiple articles but fails if I have only one, because the only article is both a next_only and a prev_only.
From my configuration, it inherits the two links which are broken because there is neither a previous article nor a next one.
I discovered that because all the articles of my series are currently draft except the first one.
You can reproduce that with the attached website:
series-intro-outro-test-website.zip
Running
zola serve -drafts
works as expected but runningzola serve
has the bad behavior.I know I could just wait to have multiple articles before commiting my code but all of this made me think we may be missing some templates
We could add a
has_prev
and ahas_next
templates.In terms of precedence, I would go for:
next_only
/middle
/prev_only
>has_prev
/has_next
>default
.I would be happy to get your thoughts about that.
I could have a look at implementing it if you think it is worth it.
Edit: I removed renaming of
next_only
andprev_only
(intofirst
,last
) after looking at the code.We should keep
next_only
andprev_only
for retro-compatibility but I would deprecate them in favor offirst
andlast
.Beta Was this translation helpful? Give feedback.
All reactions