What is the best aproach of including meta
tags only in blog-post pages?
#7701
-
I want to include specific Meta html tags in blog post's I first thought I could extend the {% extends "main.html" %}
{% block site_meta %}
{{ super() }} <!-- Make sure we include previous meta stuff -->
<meta name="lorem" content="ipsum">
{% endblock site_meta %} and while this seems to include the tag as wanted, does the page change. Namely, the infobox on the left-hand side is completely gone. Trying to fix this, i.e. by also importing nav items and To be clear: My goal is to have a meta tag only in blog posts, but no other pages. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 6 replies
-
Hello @Andre601, If it's not working please provide a full example, so that we can reproduce it. Reference on how to do: |
Beta Was this translation helpful? Give feedback.
If that's the only thing you're changing in the blog-post.html, you could just forgo the file override and just override the site_meta block inside your
main.html
. You should be able too access variables like{{ page.__class__.__module__ }}
or{{ page.__class__.__name__ }}
to detect what is the Page's class, and then you'd use it in a conditional to limit the changes accordingly.Or without Python shenanigans, just access the
page.meta.template
to find out what the template name is and check if it'sblog-post.html
😅