Index of every page on this site: llms.txt

Build Cache

For CI/CD environments, you can enable persistent build caching to skip regenerating images when the output would be identical between deployments.

Setup

nuxt.config.ts
export default defineNuxtConfig({
  ogImage: {
    buildCache: true
  }
})

This stores rendered images in node_modules/.cache/nuxt-seo/og-image/ during prerendering.

When using pnpm, this will be in the node_modules/.pnpm directory's cache structure. Consider using a custom cache directory for consistency.

Invalidation

The cache automatically invalidates when:

  • Options change: different title, description, or other props
  • Template changes: the component file is modified
  • Module version changes: you upgrade nuxt-og-image

Automatic cleanup: after each prerender, orphaned cache files (images no longer generated) are automatically cleaned up if they're older than 7 days. This prevents unbounded cache growth while preserving images that social platforms may still be referencing.

CI Configuration

To persist the cache between CI runs, add the cache directory to your CI configuration:

- name: Cache OG Images
  uses: actions/cache@v4
  with:
    path: node_modules/.cache/nuxt-seo
    key: og-images-${{ github.ref_name }}

Custom Cache Directory

You can customize the cache location:

nuxt.config.ts
export default defineNuxtConfig({
  ogImage: {
    buildCache: {
      base: '.cache/og-image'
    }
  }
})
Was this page helpful?