feat: add canonical redirect, og_image, next_page_url, and sitemap caching across content routers

Implement canonical_redirect helper in content.py to enforce slug-based 301 redirects for gist, news, post, and project detail pages. Add first_image_url helper to extract primary image from item or attachments for Open Graph meta tags. Inject next_page_url into feed, gists, news, and projects list page SEO contexts for pagination link rel. Extend seo.py with SITEMAP_URL_LIMIT, SITEMAP_TTL constants and _sitemap cache variable for future sitemap generation optimization. Update profile page to raise 404 via not_found instead of 302 redirect, and include og_image from avatar_url.
This commit is contained in:
2026-06-05 18:05:07 +00:00
parent 9a24a90ec5
commit f05b6a4faf
14 changed files with 326 additions and 23 deletions
+2
View File
@@ -7,6 +7,8 @@
<title>{% if page_title %}{{ page_title }}{% else %}DevPlace - The Developer Social Network{% endif %}</title>
<meta name="description" content="{% if meta_description %}{{ meta_description }}{% else %}Track industry shifts. Discover bold releases. Share what you're building in an open, uncensored environment.{% endif %}">
<link rel="canonical" href="{{ canonical_url or request.url }}">
{% if prev_url %}<link rel="prev" href="{{ prev_url }}">{% endif %}
{% if next_url %}<link rel="next" href="{{ next_url }}">{% endif %}
<meta name="robots" content="{{ meta_robots or 'index,follow' }}">
<meta property="og:title" content="{{ og_title or page_title or 'DevPlace' }}">