Fix site_path tag

This commit is contained in:
Joachim 2021-05-26 16:57:28 +02:00
parent 3ea935e7ce
commit 7ea3153026
5 changed files with 8 additions and 14 deletions

View file

@ -1,5 +1,6 @@
""" customize the info available in context for rendering templates """
from bookwyrm import models
from bookwyrm.settings import DOMAIN
def site_settings(request): # pylint: disable=unused-argument
@ -7,4 +8,5 @@ def site_settings(request): # pylint: disable=unused-argument
return {
"site": models.SiteSettings.objects.get(),
"active_announcements": models.Announcement.active_announcements(),
"site_path": "https://%s" % DOMAIN,
}

View file

@ -4,8 +4,8 @@
{% block title %}{{ book|book_title }}{% endblock %}
{% block opengraph_images %}
<meta name="twitter:image" content="{{ get_path }}/images/{{ book.preview_image }}">
<meta name="og:image" content="{{ get_path }}/images/{{ book.preview_image }}">
<meta name="twitter:image" content="{{ site_path }}/images/{{ book.preview_image }}">
<meta name="og:image" content="{{ site_path }}/images/{{ book.preview_image }}">
{% endblock %}
{% block content %}

View file

@ -17,8 +17,8 @@
<meta name="og:description" content="{{ site.instance_tagline }}">
{% block opengraph_images %}
<meta name="twitter:image" content="{{ get_path }}/images/{{ site.preview_image }}">
<meta name="og:image" content="{{ get_path }}/images/{{ site.preview_image }}">
<meta name="twitter:image" content="{{ site_path }}/images/{{ site.preview_image }}">
<meta name="og:image" content="{{ site_path }}/images/{{ site.preview_image }}">
{% endblock %}
<meta name="twitter:image:alt" content="BookWyrm Logo">
</head>

View file

@ -8,8 +8,8 @@
{% block title %}{{ user.display_name }}{% endblock %}
{% block opengraph_images %}
<meta name="twitter:image" content="{{ get_path }}/images/{{ user.preview_image }}">
<meta name="og:image" content="{{ get_path }}/images/{{ user.preview_image }}">
<meta name="twitter:image" content="{{ site_path }}/images/{{ user.preview_image }}">
<meta name="og:image" content="{{ site_path }}/images/{{ user.preview_image }}">
{% endblock %}
{% block content %}

View file

@ -1,8 +1,6 @@
""" template filters used for creating the layout"""
from django import template, utils
from bookwyrm.settings import DOMAIN
register = template.Library()
@ -11,9 +9,3 @@ def get_lang():
"""get current language, strip to the first two letters"""
language = utils.translation.get_language()
return language[0 : language.find("-")]
@register.simple_tag(takes_context=False)
def get_path():
"""get protocol and host"""
return "https://%s" % DOMAIN