Rename last_build_date to latest_date
The variable name matched the RSS tag it ended up in, but was misleading about what it actually was—because if you actually want “last build date”, you should use `now()`. (Due to the potential for edits, I think that either there should be an official `updated` field on pages, or that these templates should use `now()`.)
This commit is contained in:
parent
e25915b231
commit
048949ea31
|
@ -8,6 +8,7 @@
|
|||
- Config value `rss_limit` is renamed to `feed_limit`
|
||||
- Config value `languages.*.rss` is renamed to `languages.*.feed`
|
||||
- Config value `generate_rss` is renamed to `generate_feed`
|
||||
- Feed template variable `last_build_date` is renamed to `latest_date`
|
||||
|
||||
Users with existing feeds should either set `feed_filename = "rss.xml"` in config.toml to keep things the same, or set up a 3xx redirect from rss.xml to atom.xml so that existing feed consumers aren’t broken.
|
||||
|
||||
|
|
|
@ -1065,7 +1065,7 @@ impl Site {
|
|||
|
||||
pages.par_sort_unstable_by(sort_actual_pages_by_date);
|
||||
|
||||
context.insert("last_build_date", &pages[0].meta.date.clone());
|
||||
context.insert("latest_date", &pages[0].meta.date.clone());
|
||||
let library = self.library.read().unwrap();
|
||||
// limit to the last n elements if the limit is set; otherwise use all.
|
||||
let num_entries = self.config.feed_limit.unwrap_or_else(|| pages.len());
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<link href="{{ feed_url | safe }}" rel="self" type="application/atom+xml"/>
|
||||
<link href="{{ config.base_url | safe }}"/>
|
||||
<generator uri="https://www.getzola.org/">Zola</generator>
|
||||
<updated>{{ last_build_date | date(format="%+") }}</updated>
|
||||
<updated>{{ latest_date | date(format="%+") }}</updated>
|
||||
<id>{{ feed_url | safe }}</id>
|
||||
{%- for page in pages %}
|
||||
<entry
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<generator>Zola</generator>
|
||||
<language>{{ config.default_language }}</language>
|
||||
<atom:link href="{{ feed_url | safe }}" rel="self" type="application/rss+xml"/>
|
||||
<lastBuildDate>{{ last_build_date | date(format="%a, %d %b %Y %H:%M:%S %z") }}</lastBuildDate>
|
||||
<lastBuildDate>{{ latest_date | date(format="%a, %d %b %Y %H:%M:%S %z") }}</lastBuildDate>
|
||||
{%- for page in pages %}
|
||||
<item>
|
||||
<title>{{ page.title }}</title>
|
||||
|
|
|
@ -20,6 +20,6 @@ need to provide a template yourself.
|
|||
The feed template gets three variables in addition to `config`:
|
||||
|
||||
- `feed_url`: the full url to that specific feed
|
||||
- `last_build_date`: the date of the latest post
|
||||
- `latest_date`: the date of the latest post
|
||||
- `pages`: see [page variables](@/documentation/templates/pages-sections.md#page-variables) for
|
||||
a detailed description of what this contains
|
||||
|
|
Loading…
Reference in a new issue