Open kevquirk opened 4 years ago
Would love to see this as well. Btw. even if it seems trivial, but could you tell me how this is done with the standard quark theme being used?
Thanks
Yes, I too was surprised that it wasn't inserted automatically. But it is easy enough, as Kevquirk said. If you edit /user/themes/quark/templates/partials/base.html.twig
to insert those three lines (or just the middle one!) somewhere between line 8 and lines 18, it should work fine.
I'm not so sure it's that trivial. Changing base.html.twig puts it on every page, right? But if you play by Google rules it should only be on one page - the main podcast page. This is what I picked up:
Google is very strict on this, you can only have one link rel=”alternate” …> in any given page and they only want to see it on the main webpage for your podcast website, not all pages.
My fix was an extra podcast template with {% extends 'partials/audio.html.twig' %} at the top instead of base.html.twig having the rel="alternate" in there then.
My approach to the problem @rzw brought up was to amend the base.html.twig
template as follows:
{% block head %}
{# the usual contents #}
{% block head_content %}{% endblock %}
{% endblock %}
Which then enabled me to have a blog.html.twig
which does:
{% block head_content %}
<link rel="alternate" type="application/rss+xml" href="{{ base_url }}.rss">
{% endblock %}
However, I think an alternative (or maybe additionally), there could be some if
block that checks for whether or not the page has the content
header field - same condition as the plugin uses to generate the feed in the first place. Something like this (untested, just to illustrate):
{% block head_content %} {# maybe #}
{% if page.header.content %}
<link rel="alternate" type="application/rss+xml" href="{{ base_url }}.rss">
{% endif %}
{% endblock %} {# maybe #}
I added this to my blog theme. It seems to work nicely. I tried it with the for pay theme of typhoon theme. It worked. Thanks for the tip.
I'm using this plugin for my site, but I was surprised to see that
<link rel="alternate">
was not added to the header automatically.Adding this to the header is trivial, but I would have expected to see this added automatically to aid in feed discovery.
Can a fix be added that automatically add the code below to the base.html.twig file?