getgrav / grav-plugin-feed

Grav Feed Plugin
https://getgrav.org
MIT License
16 stars 11 forks source link

redirect_default_route breaks the plugin #44

Closed hexplor closed 5 years ago

hexplor commented 5 years ago

redirect_default_route: true in system.yaml break the plugin completely. If set to false, plugin is back to life :)

bartoszwanot commented 5 years ago

Would be nice to have it fixed :)

hexplor commented 5 years ago

any chance @rhukster ?

rhukster commented 5 years ago

i have this on my list of things to look at.. just focusing on getting 1.6 released at the moment.

rhukster commented 5 years ago

I've looked into this and it's tricky. The main problem is that redirect_default_route is doing what you are asking to do .. when you request /blog.rss and you are on the homepage /.. even though /blog is the actual page, the default route is /.

The quick fix is to manually create the RSS feed buttons or change the path so that you go to /.rss or /.atom, etc. This actually does work although it looks pretty crappy.

rhukster commented 5 years ago

Actually have a fix that is going out in next release that will make this work by allowing /blog.rss to redirect to /.rss and work.. even though it looks crap :)

hexplor commented 5 years ago

Small change:

<link rel="alternate" type="application/atom+xml" title="My Feed" href="{{ base_url }}/.atom" />
<link rel="alternate" type="application/rss+xml" title="My Feed" href="{{ base_url }}/.rss" />
<link rel="alternate" type="application/json" title="My Feed" href="{{ base_url }}/.json" />

This will work also for multilang websites.

rhukster commented 5 years ago

That works for you at the root, but non-root based feeds will just use the {{ base_url }}/my-route.rss type url. This is really an implementation detail, not something that can be fixed in feeds itself.