Skip to content

Commit

Permalink
Fix opengraph embed images on homepage and content detail
Browse files Browse the repository at this point in the history
  • Loading branch information
Apreche committed Sep 21, 2023
1 parent da6abdc commit 0eb5808
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions shows/templates/shows/content_detail.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
{% extends "base.html" %}
{% load static %}
{% block title %}{{ content.title }} | {{ show.title }}{% endblock title %}
{% block opengraphextra %}
<meta property="og:title" content="{{ content.title }}" />
<meta property="og:description" content="{{ content.rendered_html|striptags }}"
{% if content.image %}
<meta property="og:image" content="{{ content.image.url }}" />
{% elif content.show.logo %}
<meta property="og:image" content="{{ content.show.logo.url }}" />
{% else %}
<meta property="og:image" content="{{request.scheme}}://{{request.META.HTTP_HOST}}{% static "img/large_logo.svg" %}" />
{% endif %}
{% endblock opengraphextra %}
{% block extrahead %}
{% comment "TODO" %}
Expand Down
2 changes: 1 addition & 1 deletion shows/templates/shows/homepage.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{% block title %}Homepage{% endblock %}
{% block opengraphextra %}
<meta property="og:title" content="Homepage" />
<meta property="og:image" content="{% static "img/large_logo.svg" %}" />
<meta property="og:image" content="{{request.scheme}}://{{request.META.HTTP_HOST}}{% static "img/large_logo.svg" %}" />
{% endblock opengraphextra %}

{% block content %}
Expand Down

0 comments on commit 0eb5808

Please sign in to comment.