mirror of
https://github.com/jointakahe/takahe.git
synced 2024-12-24 22:30:28 +00:00
b53504fe64
Creates an OpenGraph template include in base.html including the basic tags expected on all pages. Then allows any page to add additional expected tags via `context`. Currently, profiles and posts are enriched to show complete opengraph metadata, and render correctly in Discord. Note: This does not show posts in Slack like Twitter/Mastodon do. I believe this is due to Slack preferring oembed when present, which is a mastodon API endpoint we may need to create at some point.
17 lines
522 B
Python
17 lines
522 B
Python
from core.models import Config
|
|
|
|
|
|
def config_context(request):
|
|
return {
|
|
"config": Config.system,
|
|
"config_identity": (
|
|
request.identity.config_identity if request.identity else None
|
|
),
|
|
"top_section": request.path.strip("/").split("/")[0],
|
|
"opengraph_defaults": {
|
|
"og:site_name": Config.system.site_name,
|
|
"og:type": "website",
|
|
"og:title": Config.system.site_name,
|
|
"og:url": request.build_absolute_uri(),
|
|
},
|
|
}
|