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

Default RSS template generates invalid feeds #762

Closed
kanru opened this issue Jul 28, 2019 · 13 comments
Closed

Default RSS template generates invalid feeds #762

kanru opened this issue Jul 28, 2019 · 13 comments
Labels
done in pr Already done in a PR

Comments

@kanru
Copy link

kanru commented Jul 28, 2019

Bug Report

Environment

Zola version: 0.8.0

Expected Behavior

RSS feed is validated by https://validator.w3.org/feed/ and RSS readers

Current Behavior

Generated RSS feed urlencodes the whole URL, which has some undesirable effects:

  1. Not considered valid by W3C feed validator.
  2. RSS readers like Feedly and Inoreader both thought the URL is a relative link so concatenate the channel link and the item link which generates a complete wrong link to the article.

Step to reproduce

  1. zola init test
  2. Add an article with date
  3. zola build

Paste the generated public/rss.xml to https://validator.w3.org/feed/check.cgi

For example

https://gist.github.com/kanru/3926d9ad1a8b6ce5586fe7bad301dbfb

has following errors

  1. line 5, column 35: link must be a full and valid URL: https%3A//example.com
  2. line 15, column 56: link must be a full and valid URL: https%3A//example.com/hello-world/
  3. line 16, column 56: guid must be a full URL, unless isPermaLink attribute is false: https%3A//example.com/hello-world/
  4. line 9, column 95: Relative href value on self link: https%3A//example.com/rss.xml

RSS reader would generate something like: https://example.com/https%3A//example.com/https%3A//example.com/hello-world/

@Keats
Copy link
Collaborator

Keats commented Jul 28, 2019

A bug in the RSS namespace already be fixed in the next branch if you want to give it a try (reported in #722)

The reason it is encoding everything was to fix #705 and that I thought tools would just understand encoded URLs :(.

@kanru
Copy link
Author

kanru commented Jul 28, 2019

Cool, I'll give the next branch a try!

@Keats
Copy link
Collaborator

Keats commented Jul 28, 2019

It's not fixing the urlencoding yet though! Only the namespace that was invalid

@kanru
Copy link
Author

kanru commented Jul 28, 2019

Gotcha. I guess we need a url_safe filter or wrap the content in <![CDATA[ ]]> everywhere.

@Keats
Copy link
Collaborator

Keats commented Jul 28, 2019

Yeah, I'm not sure what's the best solution. I think not allowing & and other special characters in the slugs is the simplest fix

@jlricon
Copy link

jlricon commented Jul 30, 2019

As next is failing to build, if anyone stumbles on this thread, the quickest fix is just to add a

sed -i 's/%3A/:/g' public/sitemap.xml
sed -i 's/%3A/:/g' public/rss.xml

to the build script, until the issue gets resolved.

@Keats
Copy link
Collaborator

Keats commented Jul 30, 2019

What error do you get with next? It should build correctly, unless you talk about the RSS templates themselves?

@jlricon
Copy link

jlricon commented Jul 31, 2019

Here it is: https://paste.ubuntu.com/p/xGN72JDdVZ/
cargo build --release works fine for master on my laptop (Ubuntu 19.04).

@Keats
Copy link
Collaborator

Keats commented Jul 31, 2019

Really weird, I don't get that error and all CI pass for next 😕

@jlricon
Copy link

jlricon commented Jul 31, 2019

Hm, I'll look later if there's anything wrong with my setup. I even did a cargo clean in-between, and I don't have any odd custom versions of build-utils

@Keats
Copy link
Collaborator

Keats commented Aug 1, 2019

Do you maybe have a global installation of libsass somehow?

@jlricon
Copy link

jlricon commented Aug 1, 2019

I realised I wasn't running it inside nix-shell; doing it fixed the build!

@Keats
Copy link
Collaborator

Keats commented Aug 5, 2019

The next branch should be working fine again.

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

No branches or pull requests

3 participants