Skip to content

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

@domsson

Description

@domsson

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions