Setting up social cards
DocsForge includes basic OpenGraph metadata automatically. Every page generates:
og:title— Page titleog:description— Page description or site descriptionog:type—websiteog:url— Canonical page URLog:site_name— Site name
Basic configuration
Set site-wide defaults in docsforge.yml:
site_name: My Project Docs
site_description: Complete documentation for My Project
site_url: https://docs.example.com/
Customizing per page
Override metadata for individual pages using front matter:
---
description: Custom description for this page
---
Social card image
DocsForge does not automatically generate social card images. To add a custom card image, place the image in your docs/ folder and reference it with an absolute URL in your site metadata or custom templates:
site_name: My Project Docs
site_description: Complete documentation for My Project
site_url: https://docs.example.com/
extra:
social_image: https://docs.example.com/assets/images/social-card.png
Create a 1200×630 PNG image for optimal display across platforms. You can then use extra.social_image in a custom main.html override to populate twitter:image and og:image tags.
Platform-specific tags
Twitter/X
Twitter uses its own card system. DocsForge sets these automatically:
twitter:card—summaryorsummary_large_imagetwitter:title— Page titletwitter:description— Page descriptiontwitter:image— Social card image (if configured)
LinkedIn uses standard OpenGraph tags. Ensure your site_url is set correctly for LinkedIn to fetch metadata.
Discord
Discord embeds use OpenGraph tags. The description is truncated to ~300 characters, so keep descriptions concise.
Verifying your cards
Test with these tools:
Troubleshooting
Cards not appearing
- Ensure
site_urlis set correctly indocsforge.yml - Your site must be publicly accessible (validators can't reach localhost)
- Platforms cache metadata — use the debugger tools to force a refresh
- Check that your image URL is absolute (not relative)
Wrong image or description
- Check page front matter for
descriptionoverrides - Ensure
site_descriptionis set indocsforge.yml - First paragraph of each page is used as fallback description
- Image dimensions should be 1200×630 for optimal display
Image not loading
- Use absolute URLs:
https://docs.example.com/assets/images/card.png - Ensure the image is accessible without authentication
- Check the image is under 5MB (platform limits vary)
- Use PNG or JPEG format (avoid WebP for social cards)
Best practices
- Keep descriptions under 160 characters
- Use consistent branding across all pages
- Test cards on multiple platforms before sharing
- Update card images when doing major releases
- Include your logo in the card image for brand recognition