Atom template authors (#2259)
* templates:atom: add support for multiple authors Atom 1.0 [0] support multiple `<author>` entries in the feed. This commit modified the template to generate as many `<author>` as the page's metadata contains. [0] https://validator.w3.org/feed/docs/atom.html#recommendedEntryElements * Test we can have multiple authors in ATOM feeds
This commit is contained in:
parent
c18a0c8031
commit
a1ac81681b
@ -680,6 +680,11 @@ fn can_build_feeds() {
|
||||
assert!(file_contains!(public, "posts/tutorials/programming/atom.xml", "Rust"));
|
||||
// It doesn't contain articles from other sections
|
||||
assert!(!file_contains!(public, "posts/tutorials/programming/atom.xml", "Extra Syntax"));
|
||||
|
||||
// Test Atom feed entry with 3 authors
|
||||
assert!(file_contains!(public, "posts/tutorials/programming/atom.xml", "Foo Doe"));
|
||||
assert!(file_contains!(public, "posts/tutorials/programming/atom.xml", "Bar Doe"));
|
||||
assert!(file_contains!(public, "posts/tutorials/programming/atom.xml", "Baz Doe"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -24,17 +24,23 @@
|
||||
<title>{{ page.title }}</title>
|
||||
<published>{{ page.date | date(format="%+") }}</published>
|
||||
<updated>{{ page.updated | default(value=page.date) | date(format="%+") }}</updated>
|
||||
{% for author in page.authors %}
|
||||
<author>
|
||||
<name>
|
||||
{%- if page.authors -%}
|
||||
{{ page.authors[0] }}
|
||||
{%- elif config.author -%}
|
||||
{{ author }}
|
||||
</name>
|
||||
</author>
|
||||
{% else %}
|
||||
<author>
|
||||
<name>
|
||||
{%- if config.author -%}
|
||||
{{ config.author }}
|
||||
{%- else -%}
|
||||
Unknown
|
||||
{%- endif -%}
|
||||
</name>
|
||||
</author>
|
||||
{% endfor %}
|
||||
<link rel="alternate" href="{{ page.permalink | safe }}" type="text/html"/>
|
||||
<id>{{ page.permalink | safe }}</id>
|
||||
{% if page.summary %}
|
||||
|
@ -2,6 +2,7 @@
|
||||
title = "Rust"
|
||||
weight = 2
|
||||
date = 2017-01-01
|
||||
authors = ["Foo Doe", "Bar Doe", "Baz Doe"]
|
||||
+++
|
||||
|
||||
A simple page
|
||||
|
Loading…
Reference in New Issue
Block a user