Fallback and Overrides¶
Every field in the payload resolves through a priority chain. The first non-empty value wins. This page shows how to control that chain.
You do not need to set every field on every entity. Set sensible defaults in the config, override per entity for most fields, and override per call for edge cases.
The precedence order¶
SEOOverrides: per-call overrides (highest priority).SEOEntity: content fields.SEOConfig: site-wide defaults.- Hardcoded defaults: library fallbacks (lowest priority).
Setting a config default¶
A site-wide fallback image applies to every page that has no image of its own:
Overriding per entity¶
A featured image on the entity beats the config default:
Overriding per call¶
SEOOverrides wins over both the entity and the config. Use it for one-off
pages, campaign tags, or a locked-down title.
A worked example¶
config = SEOConfig(
canonical_host="example.com",
public_base_url="https://example.com",
default_og_image="https://cdn.example.com/default.jpg",
)
entity = SEOEntity(
entity_type="post",
title="Post title",
featured_image=SEOImage(url="https://cdn.example.com/hero.jpg"),
)
overrides = SEOOverrides(og_image=SEOImage(url="https://cdn.example.com/urgent.jpg"))
payload = build_seo_payload(entity, "/post", config, overrides)
assert payload.og.image == "https://cdn.example.com/urgent.jpg"
The og:image resolution ran overrides.og_image first, found a value, and
stopped. Without the override it would have used the entity image; without
that, the config default.
Field-by-field chains¶
The full chain for every field, including the entity-status rules for robots and the cascade from Open Graph to Twitter, is in Fallback Chains.
Recap¶
- Resolution is Overrides > Entity > Config > default.
- Use config defaults for site-wide values.
- Use entity fields for content-specific values.
- Use
SEOOverridesfor per-call edge cases.
Next: Rendering HTML.