Add specific social media image

This commit is contained in:
Raphael Michel
2019-11-15 09:55:50 +01:00
parent 1703f3d636
commit f79df47b78
7 changed files with 46 additions and 6 deletions

View File

@@ -59,7 +59,14 @@ def contextprocessor(request):
if request.event.settings.presale_css_file:
ctx['css_file'] = default_storage.url(request.event.settings.presale_css_file)
ctx['event_logo'] = request.event.settings.get('logo_image', as_type=str, default='')[7:]
ctx['social_image'] = request.event.cache.get_or_set(
'social_image_url',
request.event.social_image,
60
)
ctx['event'] = request.event
ctx['languages'] = [get_language_info(code) for code in request.event.settings.locales]

View File

@@ -11,6 +11,10 @@
{% if event.settings.meta_noindex %}
<meta name="robots" content="noindex, nofollow">
{% endif %}
<meta property="og:type" content="website" />
{% if social_image %}
<meta property="og:image" content="{{ social_image }}" />
{% endif %}
{{ block.super }}
{% endblock %}
{% block above %}

View File

@@ -12,10 +12,6 @@
{{ block.super }}
<meta property="og:title" content="{{ ev.name }}" />
<meta property="og:description" content="{{ ev.get_date_range_display }}" />
{% if event_logo %}
<meta property="og:image" content="{{ event_logo|thumb:'5000x120' }}" />
{% endif %}
<meta property="og:type" content="website" />
{% if subevent %}
<meta property="og:url" content="{% abseventurl request.event "presale:event.index" subevent=subevent.pk %}" />
{% else %}