Score:0

Print a node's image-field path on the template html.twig

cn flag

I need to get this tag into the header so facebook can pick it up when I share links to the website.

<meta id="page-image" property="og:image" content="node-image-field-path" />

I found out that you can print the image's path with this:

{{ file_url(node.field_imagen_portada.entity.uri.value) }}

However, it doesn't work in the html.twig, as if the node's fields haven't been loaded by the time the template html.twig is used.

I thought I could get around that by putting the meta tag inside the page.html.twig and then appending it to the head via js, but that didn't work.

julianx2rl avatar
cn flag
Uhm, I knew about meta-tag when asking this question, but I thought you had to apply the metatag to the images, but no it was to the content type that contains those images.I'll keep the question up anyway, just because I still don't know how to do what I asked there.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.