Skip to main content

ai-seo

AI captions/alt-text + SEO schema (Pro)

This Pro plugin auto-generates alt text and captions using a provider-agnostic AI interface and emits Schema.org ImageObject for SEO.

Install and enable

  1. Acquire a Pro license key (install from private npm if applicable)
  2. Configure the plugin with your provider adapter
  3. Pass your license key at runtime or via env

Runtime usage

import { createAiSeoPlugin } from 'photoswipe-pro/src/pro/ai-seo.js';
import { MockCaptionProvider } from 'photoswipe-pro/src/pro/providers/mock.js'; // mock for testing

const aiSeo = createAiSeoPlugin({
enabled: true,
captionProvider: MockCaptionProvider,
licenseKey: 'pswp_example_key_1234',
});

// Use with your PhotoSwipe Lightbox init

Provider interface

  • generate({ url, title, hints }) -> { alt, caption, keywords }
  • Implement adapters for your chosen AI vendor(s)

Schema emission

  • Emits an ImageObject <script type="application/ld+json"> per opened slide
  • For server-rendered schemas, disable client emission and render statically