Integrations¶
seoslug is framework-agnostic. You can use it with any Python web framework, static site generator, or build pipeline.
The general pattern is always the same:
- Build an
SEOEntityfrom your content data. - Create an
SEOConfigthat matches your deployment. - Call
build_seo_payload(orbuild_seo_payload_asyncfor async frameworks). - Inject the returned
SEOPayloadinto your template or JSON response.
Framework guides¶
| Framework | Guide | Notes |
|---|---|---|
| FastAPI | FastAPI integration | Async route handlers, dependency injection, ETag caching |
| Starlette | Starlette integration | Async endpoints, path params, middleware, Jinja2Templates |
| Django | Django integration | Class-based views, template context, Django REST Framework |
| Flask | Flask integration | Route handlers, Jinja2 templates, JSON APIs, extension pattern |
| Nuxt | Nuxt integration | useHead composable + asyncData in Nuxt 3, static or SSR |
| SvelteKit | SvelteKit integration | load function in +page.js + <svelte:head>, static or SSR |
SSG guides¶
| SSG | Guide | Notes |
|---|---|---|
| Hugo | Hugo integration | Pre-build frontmatter injection + head partial, works with any theme |
| Quartz | Quartz integration | Pre-build frontmatter injection + Head component mod |
| Next.js | Next.js integration | getStaticProps + next/head, or generateMetadata in App Router |
| Gatsby | Gatsby integration | onCreatePage in gatsby-node.js + Gatsby Head API |
| Astro | Astro integration | <Seo /> component via Astro.glob or JSON manifest |
| Zensical | Zensical integration | Inline Markdown extension + template override, or pre-build script |
| Static site generators | SSG integration | Build-time generation, JSON manifest, Pelican, MkDocs |
CMS guides¶
| CMS | Guide | Notes |
|---|---|---|
| Strapi | Strapi integration | Custom middleware to enrich API responses with SEO payloads |
Other frameworks¶
seoslug works anywhere Python runs. The integration pattern is the same:
from seoslug import SEOConfig, SEOEntity, build_seo_payload
config = SEOConfig(
canonical_host="yoursite.com",
public_base_url="https://yoursite.com",
url_policy=...,
)
entity = SEOEntity(
entity_type="page",
title="Hello",
status="published",
)
payload = build_seo_payload(entity, "/hello", config)
Use payload.to_dict() when you need a plain dict for template engines or JSON serialization. Use build_seo_payload_dict() as a shorthand.
For async frameworks, import from seoslug.async_builder: