grav-plugin-feed
grav-plugin-feed copied to clipboard
<link> using {{ base_url }} breaks when on home page with hidden slug
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?