Use event name instead of summary in social media sharing posts

This commit is contained in:
Michael Hall 2018-02-12 19:52:16 -02:00
parent aa50e85b9a
commit 2cb2089678
2 changed files with 9 additions and 4 deletions

View file

@ -1,5 +1,5 @@
{% extends "get_together/base.html" %}
{% load static %}
{% load markup static %}
{% block add_to_totle %} | {{event.name}}{% endblock %}
@ -7,7 +7,7 @@
<meta property="og:url" content="{{event.get_full_url}}" />
<meta property="og:type" content="website" />
<meta property="og:title" content="{{event.name}}" />
<meta property="og:description" content="{{event.summary}}" />
<meta property="og:description" content="{{event.summary|jsencode}}" />
<meta property="og:image" content="https://gettogether.community{% static 'img/team_placeholder.png' %}" />
<link rel="canonical" href="{{event.get_full_url}}">
{% endblock %}
@ -37,7 +37,7 @@
display: 'popup',
method: 'share',
href: '{{event.get_full_url}}',
quote: 'I\'m having a Get Together!\n\n{{event.summary}}',
quote: 'I\'m having a Get Together!\n\n{{event.name|jsencode}}',
hashtag: '#gettogether',
summary: "Let's have a Get Together!"
}, function(response){});
@ -71,7 +71,7 @@
{% if settings.SOCIAL_AUTH_FACEBOOK_KEY %}<a href="#" onClick="shareFacebook()"; class="btn btn-primary">Facebook</a>{% endif %}
{% if settings.SOCIAL_AUTH_TWITTER_KEY %}
<a class="btn btn-primary"
href="https://twitter.com/intent/tweet?text=I'm+having+a+get+together!%0D{{event.summary|urlencode}}&original_referer={{event.get_full_url|urlencode}}&url={{event.get_full_url|urlencode}}&hashtags=gettogether"
href="https://twitter.com/intent/tweet?text=I'm+having+a+get+together!%0D{{event.name|urlencode}}&original_referer={{event.get_full_url|urlencode}}&url={{event.get_full_url|urlencode}}&hashtags=gettogether"
data-size="large">
Twitter</a>
{% endif %}

View file

@ -43,3 +43,8 @@ def markdown(value, arg=''):
"""
return mark_safe(md.markdown(value))
@register.filter
@stringfilter
def jsencode(value, arg=''):
value = value.replace("\n", "\\n").replace('"', '\"').replace("'", "\'")
return mark_safe(value)