getgrav / grav-plugin-feed

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

<link> using {{ base_url }} breaks when on home page with hidden slug #65

Open domsson opened 2 years ago

domsson commented 2 years ago

If we use this snippet, as suggested in the documentation:

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

But use it on the home page, while having it set so that the home page slug is hidden, then this ends up resulting in something like this:

<link rel="alternate" type="application/rss+xml" title="My Feed" href="http://example.com/.rss" />

Which is obviously not correct. I wonder if this is a solid alternative?

{% set rss_url = page.url(true) ~ page.template() ~ ".rss" %}
<link rel="alternate" type="application/rss+xml" title="My Feed" href="{{ rss_url }}" />

It works for my current use-case, but might break in other circumstances?