feat: start adding canonical urls
This commit is contained in:
		@@ -12,6 +12,7 @@
 | 
				
			|||||||
    {% block description %}{% endblock %}
 | 
					    {% block description %}{% endblock %}
 | 
				
			||||||
    {% block og_description %}{% endblock %}
 | 
					    {% block og_description %}{% endblock %}
 | 
				
			||||||
    {% block og_image %}{% endblock %}
 | 
					    {% block og_image %}{% endblock %}
 | 
				
			||||||
 | 
					    <link rel="canonical" href="{% block canonical_url %}{% endblock %}">
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <!-- Add additional CSS in static file -->
 | 
					    <!-- Add additional CSS in static file -->
 | 
				
			||||||
    <link rel="stylesheet" href="{% static 'fellchensammlung/css/main.css' %}">
 | 
					    <link rel="stylesheet" href="{% static 'fellchensammlung/css/main.css' %}">
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -13,6 +13,7 @@
 | 
				
			|||||||
{% block og_description %}
 | 
					{% block og_description %}
 | 
				
			||||||
    <meta name="og:description" content="{{ adoption_notice.description }}">
 | 
					    <meta name="og:description" content="{{ adoption_notice.description }}">
 | 
				
			||||||
{% endblock %}
 | 
					{% endblock %}
 | 
				
			||||||
 | 
					{% block canonical_url %}{{ host }}{% url 'adoption-notice-detail' adoption_notice_id=adoption_notice.id %}{% endblock %}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
{% block og_image %}
 | 
					{% block og_image %}
 | 
				
			||||||
    {% if adoption_notice.get_photos %}
 | 
					    {% if adoption_notice.get_photos %}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -8,7 +8,7 @@
 | 
				
			|||||||
{% block description %}<meta name="description" content="{% translate "notfellchen.org listet Farbratten in Tierheimen und Pflegestellen die ein Zuhause suchen. Adoptieren statt kaufen!" %}">{% endblock %}
 | 
					{% block description %}<meta name="description" content="{% translate "notfellchen.org listet Farbratten in Tierheimen und Pflegestellen die ein Zuhause suchen. Adoptieren statt kaufen!" %}">{% endblock %}
 | 
				
			||||||
{% block og_description %}<meta name="og:description" content="{% translate "notfellchen.org listet Farbratten in Tierheimen und Pflegestellen die ein Zuhause suchen. Adoptieren statt kaufen!" %}">{% endblock %}
 | 
					{% block og_description %}<meta name="og:description" content="{% translate "notfellchen.org listet Farbratten in Tierheimen und Pflegestellen die ein Zuhause suchen. Adoptieren statt kaufen!" %}">{% endblock %}
 | 
				
			||||||
{% block og_image %}<meta property="og:image" content="{% static 'fellchensammlung/img/link_preview.png' %}" />{% endblock %}
 | 
					{% block og_image %}<meta property="og:image" content="{% static 'fellchensammlung/img/link_preview.png' %}" />{% endblock %}
 | 
				
			||||||
 | 
					{% block canonical_url %}{{ host }}{% url 'index' %}{% endblock %}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
{% block content %}
 | 
					{% block content %}
 | 
				
			||||||
    {% for announcement in announcements %}
 | 
					    {% for announcement in announcements %}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -108,3 +108,8 @@ def trust_level(level_string):
 | 
				
			|||||||
@register.filter
 | 
					@register.filter
 | 
				
			||||||
def dictkey(d, key):
 | 
					def dictkey(d, key):
 | 
				
			||||||
    return d.get(key)
 | 
					    return d.get(key)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@register.simple_tag
 | 
				
			||||||
 | 
					def host():
 | 
				
			||||||
 | 
					    return settings.host
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -141,6 +141,8 @@ STATIC_ROOT = config.get("locations", "static", fallback="/notfellchen/static")
 | 
				
			|||||||
MEDIA_ROOT = config.get("locations", "media", fallback="/notfellchen/static")
 | 
					MEDIA_ROOT = config.get("locations", "media", fallback="/notfellchen/static")
 | 
				
			||||||
MEDIA_URL = config.get("urls", "media", fallback="/media/")
 | 
					MEDIA_URL = config.get("urls", "media", fallback="/media/")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Host will be used for allowed hosts but also for canonical URLs and CSRF settings!
 | 
				
			||||||
 | 
					# Take all three into account when modifying
 | 
				
			||||||
host = config.get("notfellchen", "host", fallback='*')
 | 
					host = config.get("notfellchen", "host", fallback='*')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# see https://docs.djangoproject.com/en/3.2/ref/settings/#std-setting-ALLOWED_HOSTS
 | 
					# see https://docs.djangoproject.com/en/3.2/ref/settings/#std-setting-ALLOWED_HOSTS
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user