Skip to content

Unable to generate RSS feed #2560

Closed
Closed
@neil-lcv-cs

Description

@neil-lcv-cs

Bug Report

Hello,

I have a multilingual website generated with Zola. I want Zola to generate an RSS feed (and optionally an Atom feed) for the website’s blog section /blog/ at /blog/rss.xml using the built-in RSS template. I can’t do that anymore.

I can’t tell which release broke it, though it’s older than v0.19. I’ve been patching Zola locally since more than a year to work around this bug… and I’ve been procrastinating to post the issue until now. My apologies.

Environment

Zola version: 0.19.1

Expected Behavior

The RSS feed should be generated in the specified section.

Current Behavior

The feed is not generated (404). The atom feed, however, is getting generated.

Step to reproduce

May help :

git clone https://git.lacontrevoie.fr/lacontrevoie/blog

Current configuration:

  • generate_feeds is set to false in [languages.fr] and [languages.en] sections (config.toml).
  • generate_feeds is set to true in content/blog/_index.md and content/blog/_index.en.md.

In that configuration, /blog/atom.xml is generated but /blog/rss.xml is not, which is expected behavior since feed_filenames is not set, thus defaulting to atom.xml.

Attempt 1

Adding the option feed_filenames = ["rss.xml"] to the following sections in config.toml :

  • [languages.fr]
  • [languages.en]

Result : no effect. For some reason, the Atom feed is still generated while the RSS feed is not.

Attempt 2

Adding the option feed_filenames = ["rss.xml"] to the root section in config.toml :

Result : triggers the following error message

Building site...
Warning: config.toml contains both default language specific information at base and under section `[languages.fr]`, which may cause merge conflicts. Please use only one to specify language specific information
Error: Failed to serve the site
Error: `feed_filename` for default language is specified twice, as ["rss.xml"] and ["atom.xml"].

Attempt 3

Adding the option feed_filenames = ["rss.xml"] to the root section and the following sections in config.toml :

  • [languages.fr]
  • [languages.en]

Result : triggers the following error message

Building site...
Warning: config.toml contains both default language specific information at base and under section `[languages.fr]`, which may cause merge conflicts. Please use only one to specify language specific information
Error: Failed to serve the site
Error: `feed_filename` for default language is specified twice, as ["rss.xml"] and ["rss.xml"].

Attempt 4

Adding the option feed_filenames = ["rss.xml"] to the blog section config/blog/_index.{en,md}.

Result : triggers the following error message (invalid configuration option)

Building site...
Error: Failed to serve the site
Error: Error when parsing front matter of section `…/content/blog/_index.md`
Error: Reason: TOML parse error at line 8, column 1
  |
8 | feed_filenames = ["rss.xml"]
  | ^^^^^^^^^^^^^^
unknown field `feed_filenames`, expected one of `title`, `description`, `sort_by`, `weight`, `draft`, `template`, `paginate_by`, `paginate_reversed`, `paginate_path`, `insert_anchor_links`, `render`, `redirect_to`, `in_search_index`, `transparent`, `page_template`, `aliases`, `generate_feeds`, `extra`

Patch

I guess the default value feed_filenames = ["atom.xml"] cannot be overwritten when using language sections.

Here’s my Zola patch to locally work around this issue:

~> git diff
diff --git a/components/config/src/config/languages.rs b/components/config/src/config/languages.rs
index eca7bc95..cee07b9d 100644

--- a/components/config/src/config/languages.rs
+++ b/components/config/src/config/languages.rs
@@ -103,7 +103,7 @@ impl Default for LanguageOptions {
             title: None,
             description: None,
             generate_feeds: false,
-            feed_filenames: vec!["atom.xml".to_string()],
+            feed_filenames: vec!["atom.xml".to_string(), "rss.xml".to_string()],
             taxonomies: vec![],
             build_search_index: false,
             search: search::Search::default(),

diff --git a/components/config/src/config/mod.rs b/components/config/src/config/mod.rs
index 57ff1a80..9b7b3d70 100644

--- a/components/config/src/config/mod.rs
+++ b/components/config/src/config/mod.rs
@@ -375,7 +375,7 @@ impl Default for Config {
             languages: HashMap::new(),
             generate_feeds: false,
             feed_limit: None,
-            feed_filenames: vec!["atom.xml".to_string()],
+            feed_filenames: vec!["atom.xml".to_string(), "rss.xml".to_string()],
             hard_link_static: false,
             taxonomies: Vec::new(),
             author: None,

That said, I’m just editing the defaults to fit my needs. It doesn’t actually fix the bug.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions