Highlights
- SEO Context Overrides — RoutablePageMixin sub-routes can now provide per-route SEO metadata via well-known template context keys. Overrides are applied consistently to both
{% seo_head %}(meta tags) and{% seo_schema %}(JSON-LD structured data).
Previously, all sub-routes under a RoutablePageMixin page shared the same <title>, <meta description>, canonical URL, and OG image — inheriting from the parent page object. This caused Google to treat sub-routes as duplicate pages.
What's Changed
New Features
- feat: support SEO context overrides for RoutablePageMixin sub-routes (#106)
Supported Override Keys
| Context Key | Affects |
|---|---|
seo_title
| <title>, og:title, twitter:title, JSON-LD name, Article headline, breadcrumb name
|
seo_description
| <meta description>, og:description, twitter:description, JSON-LD description
|
seo_canonical_url
| <link rel="canonical">, og:url, JSON-LD url
|
seo_og_image
| og:image, twitter:image, JSON-LD image (accepts Wagtail Image instance)
|
Usage
from wagtail.contrib.routable_page.models import RoutablePageMixin, path
class BlogIndexPage(RoutablePageMixin, Page):
@path("<slug:slug>/")
def post_detail(self, request, slug):
post = get_object_or_404(BlogPost, slug=slug)
return self.render(request, context_overrides={
"seo_title": post.title,
"seo_description": post.summary,
"seo_canonical_url": request.build_absolute_uri(),
})No template changes required — existing {% seo_head %} and {% seo_schema %} tags automatically pick up overrides from the template context.
Contributors
Full Changelog: v0.5.1...v0.6.0