Chapter 3

Caching

Control when social card images refresh

OpenGraph+ reads HTTP cache headers from your pages to decide when to re-render social card images. Jekyll generates static files, so cache headers are set by your hosting provider.

This page covers the Jekyll side. For how OpenGraph+ handles caching at the HTTP level, see the HTTP Caching guide.

GitHub Pages

GitHub Pages sets its own cache headers and doesn’t allow customization. Use meta tag overrides instead:

<meta property="og:plus:cache:max_age" content="86400">

Add this to your layout’s <head> to set a 24-hour cache TTL regardless of what GitHub Pages returns.

Netlify

Create a _headers file in your project root (Jekyll will copy it to the output):

# _headers
/*
  Cache-Control: public, max-age=604800

Or use netlify.toml:

[[headers]]
  for = "/*"
  [headers.values]
    Cache-Control = "public, max-age=604800"

Vercel

Add headers to your vercel.json:

{
  "headers": [
    {
      "source": "/(.*)",
      "headers": [
        { "key": "Cache-Control", "value": "public, max-age=604800" }
      ]
    }
  ]
}

Cloudflare Pages

Create a _headers file in your project root:

# _headers
/*
  Cache-Control: public, max-age=604800

Meta tag overrides

Always available regardless of hosting provider. Add these to your layout’s <head>:

<meta property="og:plus:cache:max_age" content="86400">
<meta property="og:plus:cache:etag" content="v1.2.3">

When the etag changes, OpenGraph+ re-renders even if the cache hasn’t expired.

For per-page control, use Jekyll frontmatter with a custom include:

<!-- _includes/ogplus-cache.html -->
{% if page.ogplus_cache_etag %}
<meta property="og:plus:cache:etag" content="{{ page.ogplus_cache_etag }}">
{% endif %}
# In your post's frontmatter
---
title: My Post
ogplus_cache_etag: "rev-5"
---

See the HTTP Caching guide for the full reference on cache headers and meta tag overrides.

Purging

Force an immediate re-render from the OpenGraph+ dashboard by purging the cached image for any URL.

Recommendations

Page type Strategy
Static pages Long TTL via hosting headers (7 days)
Blog posts Medium TTL (1 day) + etag meta tag
GitHub Pages Meta tag overrides (no header control)
Frequently updated Short TTL + etag for instant invalidation