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

RSS_PATH doesn't work as advertised (is path and filename, excluding .xml) #3024

Closed
tbm opened this issue Apr 14, 2018 · 9 comments
Closed
Assignees
Labels

Comments

@tbm
Copy link
Contributor

tbm commented Apr 14, 2018

  • Python Version: 3.5.3
  • Nikola Version: v7.8.14
  • Operating System: Debian

A fresh config says:

# Final location for the blog main RSS feed is:
# output / TRANSLATION[lang] / RSS_PATH / rss.xml

which is in line with other _PATH variables.

But it seems RSS_PATH is actually path+filename (and .xml is appended).

With RSS_PATH = "blog/I get render_taxonomies:output/blog/.xml (instead of blog/rss.xml)

With RSS_PATH = blog/index.xml I get render_taxonomies:output/blog/index.xml.xml

@Kwpolska
Copy link
Member

indexes.py, line 94 (master) seems to be the culprit:

        if dest_type == 'rss':
            return [self.site.config['RSS_PATH'](lang)], True

I’m not sure what fix would be the best. To match the description, we can just add 'rss' to the path list. But to retain the current undocumented behavior, we’d need to check if RSS_PATH ends with /.

@felixfontein, @ralsina: any strong opinions on what to do with this?

@Kwpolska Kwpolska added the bug label Apr 14, 2018
@felixfontein
Copy link
Contributor

Actually, the True in that line should have be 'auto' (see #3015 (comment); @davidak already included that in #3015).

I think the lines should be

        if dest_type == 'rss':
            return [self.site.config['RSS_PATH'](lang), 'rss'], 'auto'

That should lead to the documented behavior (output / TRANSLATION[lang] / RSS_PATH / rss.xml).

I'm not sure how to keep the current undocumented (and wrong) behavior in a sane way. Actually, I think we simply should not (so far, nobody else complained about it anyway, IIRC).

@tbm
Copy link
Contributor Author

tbm commented Apr 15, 2018

BTW, as you're changing this, can you make the rss.xml part configurable as well. I need this to generate /blog/feed/, which is often used, i.e. I want to call my feed index.html in RSS_PATH of blog/feed.

@felixfontein
Copy link
Contributor

I'd would prefer to do that in a new PR (which doesn't require backporting to v7).

Also, I'm not sure whether using index.html is a good idea, since that would result in the wrong Content-Type to be delivered (if you don't configure your webserver accordingly to correctly handle this one file with this specific path). Also, Nikola will run filters for HTML files on the resulting file (if you configured any).

It probably makes more sense to configure your webserver so it uses rss.xml as the default file for this specific path. That should avoid all the other problems as well, and doesn't require a change to Nikola. (For nginx, doing index rss.xml; for this path should be enough; for Apache, there's DirectoryIndex rss.xml you can put in a .htaccess file in the corresponding directory. No idea for IIS, but I guess you aren't using that ;) )

@Kwpolska
Copy link
Member

Or a neat rewrite/redirect rule (nginx):

rewrite ^/blog/feed/?$ https://EXAMPLE.com/rss.xml break;

(this is a 301 redirect, you can remove the URL to have two equally functional URLs, or otherwise make it a temporary 302 redirect)

@tbm
Copy link
Contributor Author

tbm commented Apr 15, 2018

Thanks @felixfontein. I was going to say index.html is kinda a hack but then I didn't. But you're absolutely right. I should fix that in my server settings. Thanks!

@felixfontein
Copy link
Contributor

@tbm I'm glad you could resolve it this way :)

@felixfontein
Copy link
Contributor

See #3041 for discussing how to add more customization.

@ralsina
Copy link
Member

ralsina commented Apr 15, 2018

+1 to keeping the documented behaviour and not caring about undocumented one.

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

No branches or pull requests

4 participants