Django¶
The Django adapter provides template tags and a function API that read their config from Django settings.
Install¶
Configure¶
# settings.py
EASEO = {
"canonical_host": "example.com",
"public_base_url": "https://example.com",
"site_name": "Example",
"title_template": "{title} - Example",
}
If EASEO is missing, the adapter warns and falls back to localhost.
Template tags¶
Register the library and call the tags:
| Tag | Output |
|---|---|
{% easeo_head entity route %} |
Full <head> block |
{% easeo_title entity %} |
Just the <title> tag |
{% easeo_meta entity %} |
Just the meta description |
easeo_title and easeo_meta read the route from the request in the template
context.
Function API¶
from easeo.adapters.django import seo_head, easeo_title, easeo_meta
html = seo_head(entity, "/blog/post")
Pass an explicit config as the third argument to bypass settings:
Notes¶
- Output is marked safe because the payload escapes its values.
- Entities need
entity_type,title, anddescription; missingentity_typedefaults topage.