I am making a custom theme for myslef I need meta og:image in order to show the image automatically without adding in markdown I seen here Theme Variables | Grav Documentation but nothing helped me the title and description works super but in og:image it shows colon not allowed
{{ header.metadata.og:image }}
then I did some research I found we have to use it like this
{{ header.metadata.'og:image' }}
But now it shows new error Expected name or number.
Can anyone please help me regarding this?
Try {{ header.metadata['og:image'] }}
Not Working! no errors just empty space
How does your frontmatter look like?
@Iusew The following works just fine…
typography.md
---
title: Typography
metadata:
'og:title': The Rock
'og:type': video.movie
'og:url': http://www.imdb.com/title/tt0117500/
'og:image': http://ia.media-imdb.com/images/rock.jpg
---
quark/templates/default.html.twig
{% block content %}
{{ header.metadata['og:image'] }}
{{ page.content|raw }}
{% endblock %}
SUPER ULTRA Thank You So much from last 3 days I was looking for a Solution Thanks a LOT.
@Iusew, But what was the solution? Can’t be the Twig code, because my snippet is the same snippet as the one from @Karmalakas.
Did you find any issue with the frontmatter?
Please don’t mark a post as solution without pointing out what was causing the issue and what solved it.
Sorry in Karmalakas Post I bymistake copied that formatting of discourse and hence it didn’t worked, after you shown then I typed it myself it worked