MkDocs plugin
Automatically generate OG images for your MkDocs documentation
MkDocs plugin
Automatically generate dynamic OpenGraph images for every page in your MkDocs documentation. When someone shares a link to your docs, they see a live screenshot of that page.
Install: pip install mkdocs-allscreenshots-og-screenshot
Installation
Add to mkdocs.yml
site_url: https://yourdomain.com
plugins:
- search
- allscreenshots-og-screenshotVerify your domain
Go to the Social images page in your dashboard and verify your documentation domain.
That's it. Every page in your documentation now has a unique OG image.
How it works
The plugin adds an og:image meta tag to each page:
<meta property="og:image" content="https://og.allscreenshots.com?url=https://yourdomain.com/page/" />When someone shares a link on social media:
- The platform requests the OG image URL
- Allscreenshots captures a screenshot of that page
- The screenshot is cached for fast subsequent requests
- Cache hits are free and don't count toward your quota
Configuration
| Option | Default | Description |
|---|---|---|
screenshot_base_url | https://og.allscreenshots.com | Screenshot API endpoint |
site_url | MkDocs site_url | Override the site URL used in OG image URLs |
Custom configuration
plugins:
- allscreenshots-og-screenshot:
screenshot_base_url: https://og.allscreenshots.com
site_url: https://docs.example.comRequirements
- Python 3.8+
- MkDocs
- A verified domain in your Allscreenshots dashboard
Example
Given this MkDocs structure:
docs/
├── index.md
├── getting-started.md
└── api/
└── reference.mdThe plugin generates these OG images:
| Page | OG Image URL |
|---|---|
/ | https://og.allscreenshots.com?url=https://yourdomain.com/ |
/getting-started/ | https://og.allscreenshots.com?url=https://yourdomain.com/getting-started/ |
/api/reference/ | https://og.allscreenshots.com?url=https://yourdomain.com/api/reference/ |
Troubleshooting
Images not generating
Ensure your domain is verified in the dashboard. Unverified domains will receive an error response.
Wrong site URL
If your OG images point to the wrong URL, set the site_url option explicitly:
plugins:
- allscreenshots-og-screenshot:
site_url: https://docs.example.comLocal development
OG images only work for publicly accessible URLs. During local development, the images will show an error. This is expected—the images will work once deployed.
Source code
The plugin is open source and available on PyPI.
# Install for development
pip install -e .MIT License.