docs: add opengraph meta tags - #44985
Conversation
Signed-off-by: Adam Setch <adam.setch@outlook.com>
|
Verification would be best done via a preview site deployment of this branch |
RahulGautamSingh
left a comment
There was a problem hiding this comment.
The og:title uses page.title, but Material's <title> block prefers the front-matter title: (page.meta.title). On pages where the first H1 differs from the front-matter title, the social preview title won't match the browser tab.
Reproduced locally via pnpm mkdocs serve + ngrok → Slack unfurl:
Mirror Material's own html-title logic (front-matter title → page title → site name):
{% set og_title = ((page.meta.title if page and page.meta and page.meta.title else page.title) ~ ' - ' ~ config.site_name) if page and (page.title or (page.meta and page.meta.title)) else config.site_name %}|
Thanks for testing! With your reproduction, isn't that how the current prod site behaves? I'm not sure that's social cards (at least not the same richness other sites unfurl to) |
|
Small cards are still an improvement over prod (which has no og tags i.e. LinkedIn/Discord get nothing today) For bigger social cards, we would need to host a bigger banner 1200*630 which needs to be designed I assume .. @jamietanna wdyt Also worh mentioning, a static banner means every page shares the same image. Per-page images (like GitHub's auto-generated cards) need a card-generator plugin .. Material has |
Co-authored-by: RahulGautamSingh <rahultesnik@gmail.com>
I just re-tested the current state Based on the testing you did @RahulGautamSingh - i'm not noticing a difference with the og tags on this branch 🤔 |
|
In current main, we don't use og tags so the titles you see are pulled from html title. After your changes merge og title will be used. And, in some pages |


Changes
Add OpenGraph Meta Tags to mkdocs site, used for social cards
Context
Resolves discussion suggestion #31965
Please select one of the following:
AI assistance disclosure
Did you use AI tools to create any part of this pull request?
Please select one option and, if yes, briefly describe how AI was used (e.g., code, tests, docs) and which tool(s) you used.
Documentation (please check one with an [x])
How I've tested my work (please select one)
I have verified these changes via:
The public repository: