Skip to content

Commit

Permalink
Ajout d'un paramètre GET pour avoir une miniature Twitter large
Browse files Browse the repository at this point in the history
Fix #5291
  • Loading branch information
philippemilink authored and artragis committed Apr 5, 2019
1 parent 8357aed commit 5f68e0e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
6 changes: 5 additions & 1 deletion templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,11 @@

{# Twitter cards #}
<meta property="twitter:domain" content="{{app.site.url}}/">
<meta property="twitter:card" content="summary">
{% if request.GET.twittercard == 'large' %}
<meta property="twitter:card" content="summary_large_image">
{% else %}
<meta property="twitter:card" content="summary">
{% endif %}
<meta property="twitter:url" content="{{app.site.url}}{{ request.path }}">
<meta property="twitter:title" content="{{ title|safe }}">
<meta property="twitter:description" content="{{ description|safe }}">
Expand Down
6 changes: 5 additions & 1 deletion templates/tutorialv2/view/content_online.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,11 @@

{% block meta_image %}{% spaceless %}
{% if content.image %}
{{ content.image.physical|thumbnail_url:'social_network' }}
{% if request.GET.twittercard == "large" %}
{{ content.image.physical|thumbnail_url:'social_network_large' }}
{% else %}}
{{ content.image.physical|thumbnail_url:'social_network' }}
{% endif %}
{% else %}
{% load static %}
{% if content.type == 'TUTORIAL' %}
Expand Down
1 change: 1 addition & 0 deletions zds/settings/abstract_base/zds.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
'social_network': {'size': (144, 144), 'crop': True},
# ^^^ ^^^ -> minimum dimensions of 144x144
# https://developer.twitter.com/en/docs/tweets/optimize-with-cards/overview/summary
'social_network_large': {'size': (600, 314), 'crop': True}
},
}

Expand Down

0 comments on commit 5f68e0e

Please sign in to comment.