zola: Zola Builds Broken RSS/atom feed

Environment

Zola 0.16.1 running in Arch-Based Linux Distribution

Configuration

generate_feed = true
feed_filename = “atom.xml”

Steps

Enable the above configurations in config.toml
Run zola build or zola serve

Current Behavior

When I try to add the output feed atom.xml in my rss reader (I am using Thunderbird), It gives an error saying It’s not a valid Feed.
Validating the feed with w3c feed validator, it shows following errors:

Missing entry element: author
</entry>
title should not be blank
<title></title>

Expected Behavior

The feed should have been validated without any error.

Detected Problem

It generates the feed (atom.xml) with Empty title.

...
...
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
<title></title>
...
...

Remark

Using feed_filename = "rss.xml" in place generates rss.xml with empty title and description.

...
...
<channel>
<title></title>
<link>http://127.0.0.1:1111</link>
<description></description>
<generator>Zola</generator>
<language>en</language>
...
...

Temporary/Manual Solution

Adding the title manually in atom.xml solved the problem for me or adding title and description manually if you’re using rss.xml.

...
...
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
<title>My Blogs</title>
...
...

Permanent Solution

Zola should detect the default title and description in following priority order or similar appropriate one and use it:

  1. /content/blog/_index.md
  2. /templates/blog.html
  3. config.toml

Reference Project

https://github.com/whoisYoges/website

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 1
  • Comments: 20 (5 by maintainers)

Commits related to this issue

Most upvoted comments

I think so. I’ve created https://github.com/getzola/zola/pull/2092.

It seems ok to me, just need to add some words about it in the docs.

Anyone disagree with the current approach for authors?

@whoisYoges / @sangsatori just to be clear, does adding the author field makes Thunderbird happy with both RSS/atom feed?

For title/description we could error if someone asks to generate a feed but doesn’t fill both.

Yeah @Keats, It does and validates the W3C Feed Validation as well for both RSS and atom feeds.

It’s an interesting question. In Atom, author information is more structured than in RSS 2.0, and they are potentially contradictory.

  • RSS 2.0 has a single <author>...</author> element. The specification says that this should contain the email address of the author, and optionally a name, in the format author@example.com or author@example.com (Author Name).
  • On the other hand, Atom 1.0 has a structured <author>...</author> element that must contain at least <name>...</name>, but may also contain <email>...</email> and <uri>...</uri> elements

Perhaps Zola authors should be structured in a similar way? For example, in YAML we could permit:

authors:
  - name: Author One
    email: author1@example.com
  - name: Author Two
    email: author2@example.com
    uri: https://example.com/user2/
  - name: Author Three

equivalent TOML:

[[authors]]
name = "Author One"
email = "author1@example.com"

[[authors]]
name = "Author Two"
email = "author2@example.com"
uri = "https://example.com/user2"

[[authors]]
name = "Author Three"

One downside is that RSS 2.0 feeds would not validate unless the author contains an email address, and Atom 1.0 feeds would not validate unless the author contains a name. It’s a bit messy and complex.

Anyone interested in implementing #2024 (comment) ? Or if anyone has objections on that.

I ran into this issue myself and worked around it with a custom atom.xml template, so I would love to give try to fix it. It would be my first contribution to the project, but I do have Rust experience.

The title can potentially be fixed (eg use url of the site if we have nothing) but what do we do for the author?