I can't make twitter card works

I try to configure twitter cards but until now fails.
it just doesn’t produce any card so far, no image, no description, just the normal url.
I tried with another baseurl, same result, the output of twitter_cards or opengraph does not change.
Please tell me what I did wrong.

config.toml

baseurl = “/”
title = ‘my_site’
[params]
title = ‘my_site’
images = [‘/Images/history/favicons/symbole_perso_deux_arbres.webp’]

front-matter:

images = [‘/Images/spirituality/mythology/adam_eve_fall_eden.jpg’]

in inject/head.html:

{{ template “_internal/twitter_cards.html” . }}
{{ template “_internal/opengraph.html” . }}

And this is the corresponding part of the html for the homepage:

Title: “The purpose of this website”
bodystyle: “h1_intro”
booktoc: false
Kind: home

the output is:

<meta name=twitter:image content="/Images/history/favicons/symbole_perso_deux_arbres.webp">
<meta name=twitter:title content="The purpose of this website">
<meta name=twitter:description content="The purpose of this site is to promote a way of life and a vision of the world based on science as well as the spiritual rehabilitating the instincts we evolved with in terms of food, health and love life. Thanks to this definitive change of the human condition, a unification and regeneration of the human race becomes possible, in order to carry out its intended destiny, politically or otherwise.">
<meta name=twitter:site content="@NNPartyNow">
<meta property="og:title" content="The purpose of this website">
<meta property="og:description" content="The purpose of this site is to promote a way of life and a vision of the world based on science as well as the spiritual rehabilitating the instincts we evolved with in terms of food, health and love life. Thanks to this definitive change of the human condition, a unification and regeneration of the human race becomes possible, in order to carry out its intended destiny, politically or otherwise.">
<meta property="og:type" content="website">
<meta property="og:url" content="/">
<meta property="og:image" content="/Images/history/favicons/symbole_perso_deux_arbres.webp">
<meta property="og:site_name" content="my-site">

I checked on another site, and opengraph/twitter related meta tags are generated as intended or so it seems. On one page I have defined this property:

images: [‘/Images/spirituality/640px-The_Garden_of_Earthly_Delights_by_Bosch_High_Resolutioncrop.jpg’]

and it generates:

<meta name=twitter:image content=“/Images/spirituality/640px-The_Garden_of_Earthly_Delights_by_Bosch_High_Resolutioncrop.jpg”>

Someone else correct me if i’m wrong, but those paths to the image in the final output are absolute paths but dont’ lead to anywhere (likely), not relative, due to the leading slash. if you want those to work for the twitter cards or whatever, they should be absolute paths with the full URL including domain.

1 Like

then if use the internals (so not touching head.html), how am I supposed to indicate the locations in front-pages?

What is the path to your images from the root of your project?

That:

means the absolute path /home/drm/WEBSITE/static/Images/spirituality/640px-The_Garden_of_Earthly_Delights_by_Bosch_High_Resolutioncrop.jpg
At least it’s supposed to. I use the same convention for all pictures and it works. Just not for our issue here.

What is your baseURL in site config?

baseURL = “/”

That is not a valid baseURL. This value must begin with the protocol and end with a slash. For example:

https://example.org/

If you use Hugo’s embedded template, you will get:

<meta name="twitter:image" content="https://www.example.org/Images/spirituality/...

ok, now it looks like that, but it still doesn’t work.
for twitter shouldn’t this suffice ?:

<meta name=twitter:image content=fulladdressofthesite>
<meta name=twitter:site content="@NNPartyNow">
<meta name=twitter:description content=full-description>

yet it doesn’t show up

Point me to the live site so that I can look at it.

I disagree with everything you have posted and this site stands for. I sincerely hope you research alternative viewpoints and interact with people from different cultures and maybe travel the world to experience them.

Your twitter card for the home page works fine when I compose a new tweet.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.