Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to generate RSS feed #2560

Closed
neil-lcv-cs opened this issue Jul 1, 2024 · 4 comments
Closed

Unable to generate RSS feed #2560

neil-lcv-cs opened this issue Jul 1, 2024 · 4 comments

Comments

@neil-lcv-cs
Copy link

neil-lcv-cs commented Jul 1, 2024

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.

@Keats
Copy link
Collaborator

Keats commented Jul 1, 2024

I'm not sure if this is the same issue but there is #2400
I found a couple more places that need to be updated but yeah there are funky issues with feeds there

@fbarbe00
Copy link

fbarbe00 commented Jul 5, 2024

Similar issue for me! My RSS feed stopped working completely since I updated zola, it returns a 404 page

@Keavon
Copy link

Keavon commented Jul 29, 2024

Edit: Sorry, disregard this. I very stupidly forgot to actually update my own local install of Zola, thinking that the CI version number update would actually apply locally. This works on my end now. Is there some sort of MSRV equivalent for Zola so it can throw an error if the installed version is below that?

Upon upgrading from 0.17.2 to 0.19.1, and switching our config.toml to...

- feed_filename = "rss.xml"
+ feed_filenames = ["rss.xml"]

...I still can't get my feed at /blog/rss.xml to work like it used to. It's just my 404 page. I have to downgrade until this is fixed. Our website code is here if you want to check for anything while digging into the bug. Thanks.

@neil-lcv-cs
Copy link
Author

Fixed for me since 0.19.2, by adding feed_filenames = ["rss.xml"] in language sections (see Attempt 1 in the issue description).

Thank you! I’m closing the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants