OpenGraph og:url contains additional forward slash creating invalid URL (template/header.html issue?) #51

Closed
opened 2026-03-17 15:15:25 +01:00 by neil_neilzone · 1 comment

When a post/page (both, I think) is generated, the resulting og:url contains an extra forward slash, meaning an invalid URL.

For instance, on https://my-notes.dragas.net/about/, the og:url string is <meta property="og:url" content="https://my-notes.dragas.net//about/">.

I would have expected it to be <meta property="og:url" content="https://my-notes.dragas.net/about/">, with one, not two, forward slashes between the site_url and the page_url.

(Using your instance as an example, to rule it being a config issue on my side!)

For me, in config.sh.local, I have SITE_URL="https://neilzone.co.uk" and URL_SLUG_FORMAT="Year/Month/slug" # Format for post URLs. Available: Year, Month, Day, slug, but I still get `

I have edited my templates/header.html file, to change <meta property="og:url" content="{{site_url}}/{{page_url}}"> to <meta property="og:url" content="{{site_url}}{{page_url}}">. This has fixed it, but I don't know if this is the best way of fixing it.

(Although the URL is invalid, it does not appear to impact display on Mastodon, but I do not understand why there is no impact.)

When a post/page (both, I think) is generated, the resulting `og:url` contains an extra forward slash, meaning an invalid URL. For instance, on https://my-notes.dragas.net/about/, the og:url string is `<meta property="og:url" content="https://my-notes.dragas.net//about/">`. I would have expected it to be `<meta property="og:url" content="https://my-notes.dragas.net/about/">`, with one, not two, forward slashes between the site_url and the page_url. (Using your instance as an example, to rule it being a config issue on my side!) For me, in config.sh.local, I have `SITE_URL="https://neilzone.co.uk"` and `URL_SLUG_FORMAT="Year/Month/slug" # Format for post URLs. Available: Year, Month, Day, slug`, but I still get <meta property="og:url" content="https://neilzone.co.uk//2026/03/moving-my-static-site-blog-generator-from-hugo-to-bssg/">` I have edited my templates/header.html file, to change `<meta property="og:url" content="{{site_url}}/{{page_url}}">` to `<meta property="og:url" content="{{site_url}}{{page_url}}">`. This has fixed it, but I don't know if this is the best way of fixing it. (Although the URL is invalid, it does not appear to impact display on Mastodon, but I do not understand *why* there is no impact.)
Owner

This should have been fixed in master - thanks!

This should have been fixed in master - thanks!
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: stefano/BSSG#51
No description provided.