Fix: bibliography month persists to subsequent entries without month (#3391)
Fixes #3386 (the part about the wrong months; the other part (layouting of bibtex) is fixed in #3387) ## Summary - Fixes incorrect month shown for bibliography entries that do not specify a `month` in BibTeX. - Ensures `month`/`year` do not persist between entries in `_layouts/bib.liquid`. ## Root Cause - In Liquid, captured variables persist across iterations if not reinitialized. - `entrymonth` and `entryyear` were only set when `entry.month`/`entry.year` existed, causing values from a previous entry to leak into the next one when those fields were missing. ## Changes - Reinitialize date-related variables per entry before conditional captures: ## Behavior - Before: Entries without a `month` could display the previous entry's month. - After: Entries without a `month` display only the `year`; entries with a `month` display the correct month and year. <img width="1956" height="918" alt="image" src="https://github.com/user-attachments/assets/7a9682e7-55ab-43b7-8f82-f638d14ce08e" />
This commit is contained in:
parent
6023fd809f
commit
f521c0ae5c
@ -160,9 +160,11 @@
|
|||||||
{% else %}
|
{% else %}
|
||||||
{% capture entrytype %}{% endcapture %}
|
{% capture entrytype %}{% endcapture %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% assign entrymonth = '' %}
|
||||||
{% if entry.month %}
|
{% if entry.month %}
|
||||||
{% capture entrymonth %}{{ " " }}{{ entry.month | capitalize }}{% endcapture %}
|
{% capture entrymonth %}{{ " " }}{{ entry.month | capitalize }}{% endcapture %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% assign entryyear = '' %}
|
||||||
{% if entry.year %}
|
{% if entry.year %}
|
||||||
{% capture entryyear %}{{ " " }}{{ entry.year }}{% endcapture %}
|
{% capture entryyear %}{{ " " }}{{ entry.year }}{% endcapture %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user