Improve SEO
This commit is contained in:
parent
aed8adeea4
commit
bbeed5c9f0
6 changed files with 1331 additions and 45 deletions
|
|
@ -16,14 +16,13 @@
|
|||
<link rel="manifest" href="{% static 'site.webmanifest' %}" />
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta name="description"
|
||||
content="Twitch Drops Tracker - Track your Twitch drops and campaigns easily." />
|
||||
<meta name="keywords" content="Twitch, Drops" />
|
||||
<title>
|
||||
{% block title %}
|
||||
ttvdrops
|
||||
{% endblock title %}
|
||||
</title>
|
||||
{% include "includes/meta_tags.html" %}
|
||||
<style>
|
||||
html {
|
||||
color-scheme: light dark;
|
||||
|
|
|
|||
70
templates/includes/meta_tags.html
Normal file
70
templates/includes/meta_tags.html
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
{# SEO Meta Tags Include #}
|
||||
{# #}
|
||||
{# Expected context variables: #}
|
||||
{# - page_title: str - Page title (defaults to "ttvdrops") #}
|
||||
{# - page_description: str - Page description (defaults to site description) #}
|
||||
{# - page_image: str - Image URL for og:image (optional) #}
|
||||
{# - page_url: str - Full URL for og:url and canonical (defaults to request.build_absolute_uri) #}
|
||||
{# - og_type: str - OpenGraph type (defaults to "website") #}
|
||||
{# - schema_data: str - JSON-LD schema data serialized as string (optional) #}
|
||||
{# - breadcrumb_schema: str - Breadcrumb JSON-LD schema (optional) #}
|
||||
{# - pagination_info: dict - {"rel": "prev|next|first|last", "url": "..."} (optional) #}
|
||||
{# - published_date: str - ISO 8601 published date (optional) #}
|
||||
{# - modified_date: str - ISO 8601 modified date (optional) #}
|
||||
{# - robots_directive: str - robots meta content (default: "index, follow") #}
|
||||
{# #}
|
||||
{% load static %}
|
||||
{# Preconnect to external resources for performance #}
|
||||
<link rel="preconnect" href="https://static-cdn.jtvnw.net" />
|
||||
<link rel="dns-prefetch" href="https://static-cdn.jtvnw.net" />
|
||||
{# Description meta tag #}
|
||||
<meta name="description"
|
||||
content="{% firstof page_description 'ttvdrops - Track Twitch drops.' %}" />
|
||||
{# Robots meta tag (control indexing) #}
|
||||
<meta name="robots"
|
||||
content="{% firstof robots_directive 'index, follow' %}" />
|
||||
{# Author and Copyright #}
|
||||
<meta name="author" content="TheLovinator1" />
|
||||
<meta name="copyright"
|
||||
content="This work is dedicated to the public domain under CC0 1.0 Universal." />
|
||||
{# Open Graph tags for social sharing #}
|
||||
<meta property="og:title" content="{% firstof page_title 'ttvdrops' %}" />
|
||||
<meta property="og:description"
|
||||
content="{% firstof page_description 'ttvdrops - Track Twitch drops.' %}" />
|
||||
<meta property="og:type" content="{% firstof og_type 'website' %}" />
|
||||
<meta property="og:url"
|
||||
content="{% firstof page_url request.build_absolute_uri %}" />
|
||||
{% if page_image %}
|
||||
<meta property="og:image" content="{{ page_image }}" />
|
||||
<meta property="og:image:width" content="1200" />
|
||||
<meta property="og:image:height" content="630" />
|
||||
{% endif %}
|
||||
{# Twitter Card tags for rich previews #}
|
||||
<meta name="twitter:card"
|
||||
content="{% if page_image %}summary_large_image{% else %}summary{% endif %}" />
|
||||
<meta name="twitter:title" content="{% firstof page_title 'ttvdrops' %}" />
|
||||
<meta name="twitter:description"
|
||||
content="{% firstof page_description 'ttvdrops - Track Twitch drops.' %}" />
|
||||
{% if page_image %}<meta name="twitter:image" content="{{ page_image }}" />{% endif %}
|
||||
{# Article dates for content pages #}
|
||||
{% if published_date %}<meta property="article:published_time" content="{{ published_date }}" />{% endif %}
|
||||
{% if modified_date %}<meta property="article:modified_time" content="{{ modified_date }}" />{% endif %}
|
||||
{# Canonical tag #}
|
||||
<link rel="canonical"
|
||||
href="{% firstof page_url request.build_absolute_uri %}" />
|
||||
{# Pagination links (for crawler efficiency) #}
|
||||
{% if pagination_info %}
|
||||
{% if pagination_info.rel == "prev" %}
|
||||
<link rel="prev" href="{{ pagination_info.url }}" />
|
||||
{% elif pagination_info.rel == "next" %}
|
||||
<link rel="next" href="{{ pagination_info.url }}" />
|
||||
{% elif pagination_info.rel == "first" %}
|
||||
<link rel="first" href="{{ pagination_info.url }}" />
|
||||
{% elif pagination_info.rel == "last" %}
|
||||
<link rel="last" href="{{ pagination_info.url }}" />
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{# Schema.org JSON-LD structured data #}
|
||||
{% if schema_data %}<script type="application/ld+json">{{ schema_data|safe }}</script>{% endif %}
|
||||
{# Breadcrumb schema #}
|
||||
{% if breadcrumb_schema %}<script type="application/ld+json">{{ breadcrumb_schema|safe }}</script>{% endif %}
|
||||
Loading…
Add table
Add a link
Reference in a new issue