Use a team's custom image for social media previews of their events
This commit is contained in:
parent
3d057c7f6e
commit
67626a59d9
2 changed files with 9 additions and 5 deletions
|
@ -383,6 +383,14 @@ class Team(models.Model):
|
||||||
else:
|
else:
|
||||||
return static('img/team_placeholder.png')
|
return static('img/team_placeholder.png')
|
||||||
|
|
||||||
|
@property
|
||||||
|
def full_img_url(self):
|
||||||
|
if self.card_img_url.startswith('http'):
|
||||||
|
return self.card_img_url
|
||||||
|
else:
|
||||||
|
site = Site.objects.get(id=1)
|
||||||
|
return "https://%s%s" % (site.domain, self.card_img_url)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def location_name(self):
|
def location_name(self):
|
||||||
if self.city:
|
if self.city:
|
||||||
|
|
|
@ -8,11 +8,7 @@
|
||||||
<meta property="og:type" content="website" />
|
<meta property="og:type" content="website" />
|
||||||
<meta property="og:title" content="{{event.name}}" />
|
<meta property="og:title" content="{{event.name}}" />
|
||||||
<meta property="og:description" content="{{event.summary}}" />
|
<meta property="og:description" content="{{event.summary}}" />
|
||||||
{% if event.team.category %}
|
<meta property="og:image" content="{{event.team.full_img_url}}" />
|
||||||
<meta property="og:image" content="{{event.team.category.img_url}}" />
|
|
||||||
{% else %}
|
|
||||||
<meta property="og:image" content="https://gettogether.community{% static 'img/team_placeholder.png' %}" />
|
|
||||||
{% endif %}
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block styles %}
|
{% block styles %}
|
||||||
|
|
Loading…
Reference in a new issue