Static site generator
Add automatic MyOG.social images to Eleventy layouts with page.url, site data, and server-rendered meta tags.
Eleventy exposes page.url for the current output page. Combined with a global site URL, that gives MyOG the exact public URL for each generated page.
Add the tags once in your base layout or SEO include, then let posts, pages, and collections inherit the same logic.
This works best as a small template snippet. A plugin would be unnecessary unless you want deeper theme packaging later.
MyOG detects page content and branding automatically. The layout only controls image composition.
Use this in your base layout or SEO include.
{% if page.url %}
{% set pageURL = site.url + page.url %}
{% set myogImageURL = "https://api.myog.social/og?url=" + (pageURL | urlencode) + "&template=screenshot-right" %}
<meta property="og:image" content="{{ myogImageURL }}" />
<meta property="og:image:width" content="1200" />
<meta property="og:image:height" content="630" />
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:image" content="{{ myogImageURL }}" />
{% endif %}Define site.url in global data, for example { "url": "https://example.com" }.
Many Eleventy starters already render image from front matter. Either replace that front matter image output with MyOG or keep native images only for pages where you intentionally do not want generated cards.
Use page.url for normal pages, collection items, pagination pages, and tag pages. If a permalink is false, skip MyOG because the page has no public URL.
Start with the MyOG Open Graph Checker, then refresh social platform caches if needed.
Sign up for free and add generated social cards to Eleventy pages.
Already have an account?
cdf733b534ea2f2ed964d150330b323c44837e4f