Skip to content

Fix og:url and og:image tags in base.html - #528

Open
astra-intelligence wants to merge 1 commit into
wagtail:mainfrom
astra-intelligence:fix/og-url-and-image
Open

astra-intelligence wants to merge 1 commit into
wagtail:mainfrom
astra-intelligence:fix/og-url-and-image

Conversation

@astra-intelligence

Copy link
Copy Markdown

Fix og:url and og:image tags in base.html

Closes #513

Fixes both Open Graph bugs reported in the SEO audit:

  1. og:url was relative — it used {{ site.root_url }}{{ page.url }}, but site is not defined in this template (the correct variable is current_site), so the tag rendered as just the page path (e.g. /en/). Using page.full_url emits the full absolute URL, which is what OG consumers expect.

  2. og:image used name= instead of property= — <meta name="og:image"> is not picked up by Open Graph consumers that look for property="og:image". Changed to property= to match the other og tags on the page.

Verified: page.full_url is the same pattern already asserted in apps/core/tests/test_structured_data.py — the change is a two-line template edit, minimal surface.

og:url referenced the undefined 'site' variable (template uses current_site)
and produced a relative URL; page.full_url emits the absolute URL.
og:image was emitted as name= instead of property= so OG consumers
missed it. Closes wagtail#513.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix og:url and og:image tags

1 participant