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

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

Open
domsson opened this issue Mar 1, 2022 · 0 comments
Open

Comments

@domsson
Copy link

domsson commented Mar 1, 2022

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?

@domsson domsson changed the title <link> URL with {{ base_url }} break when on home page with hidden slug <link> using {{ base_url }} breaks when on home page with hidden slug Mar 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant