Hi,
My problem is the following: twitter cards are not working, image is not showing (og works fine). I’ve gone through Card error, unable to render, or no image: READ THIS FIRST - Cards - Twitter Developers , and the only issue I find is “Are you using an absolute and full URL (including the http protocol piece), not a relative one?”
And indeed,URL in meta tags are relative, which facebook recognizes but twitter does not, for example in index.html
:
<meta name=twitter:card content="summary_large_image">
<meta name=twitter:image content="/images/banner-osc.png">
<meta name=twitter:title content="Open Source Church">
But when I run hugo --minify --gc --buildFuture
locally, here is the output of index.html
:
<meta name=twitter:card content="summary_large_image">
<meta name=twitter:image content="https://www.open-source.church/images/banner-osc.png">
<meta name=twitter:title content="Open Source Church">
So it seems to me that somewhere, netlify is changing the URL from absolute to relative, and I can find where, why or how to deactivate. This happens on https://open-source-church.netlify.app/ as well as custom domain (https://www.open-source.church/).
Here is a link to the deploy log: Netlify App. I’ve searched the doc to understand what exactly is behind those lines, but without succes:
10:03:31 AM: Starting post processing
10:03:31 AM: Post processing - HTML
10:03:35 AM: Post processing - header rules
10:03:35 AM: Post processing - redirect rules
10:03:35 AM: Post processing done
By the way, asset optimization is disabled in settings, and here is my netlify.toml
(to be honnest I’ve copied from somewhere, and I don’t understand what the headers.values means…)
[build]
publish = "public"
command = "hugo --minify --gc --buildFuture"
[build.environment]
HUGO_VERSION = "0.92.0"
HUGO_BASEURL = "/"
[[headers]]
for = "/*" # This defines which paths this specific [[headers]] block will cover.
[headers.values]
X-Frame-Options = "DENY"
X-XSS-Protection = "1; mode=block"
Referrer-Policy = "same-origin"
Strict-Transport-Security = "max-age=31536000; includeSubDomains; preload"
Thanks !