Repository navigation
Per-page social cards for Docusaurus docs and blog posts with docusaurus-plugin-myog
#13114
hboon
started this conversation in
Plugins, Themes, Presets and Libs
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
If your Docusaurus site uses
themeConfig.image, a docs page and a blog post can end up with the same card when you share them. I built MyOG.social and its Docusaurus plugin to give each page its own image while keeping the images you picked for individual posts.Add the plugin
Use stable Docusaurus 3.10 or later in the 3.x series and Node.js 20.11.0 or newer. For a plain webpack build, use Docusaurus 3.10.1 or later.
Add this entry to your existing
pluginsarray indocusaurus.config.tsor.js.Copy the
a=value from your install snippet and replaceYOURACCOUNTID. Seturl,baseUrlandtrailingSlashto match your deployment. The plugin is MIT licensed. To serve the generated images, register the exact public hostname in MyOG and have credits available from a paid plan or card trial. MyOG Docusaurus setupYou can keep
themeConfig.imageandthemeConfig.metadata. Pages without their own image use MyOG in place of the site-wide card. Remove anyog:imageandtwitter:imagetags inheadTags, which can leave duplicate tags in the built HTML.Keep a custom card on one blog post
Put your image in
static/img/release-card.png. Addimageto the front matter of a blog post, for exampleblog/2026-10-01-post-with-image.md.Both image tags on that post use the supplied image. A docs page such as
/docs/introwith no image of its own gets a MyOG URL.Check the built HTML and the served images
Run
pnpm run build. Open the generated HTML for each route. In the<head>, check that each image tag appears once./docs/intro, both tags should point to the same MyOG image URL. Decode itsurlquery parameter and compare it with the page'sog:url. Forurl: "https://docs.example.com"andbaseUrl: "/", expecthttps://docs.example.com/docs/introif that route has no trailing slash.release-card.pngon your site. For a deployment under a subpath, the image URL includes that subpath.The plugin writes the tags during the build. After deploying, copy each distinct image URL from the live page source and open it directly. Check for a successful HTTP response with an image content type, then look at the card to confirm it shows the intended page or artwork. If the MyOG image fails, check the registered hostname and available credits first.
www.example.comandexample.comneed separate registrations.If you run into an override that behaves differently, share the route type and which image tags you see in the built HTML.
All reactions