Show - Add Open Graph meta to episode and show page

This commit is contained in:
Evert Prants 2017-11-11 15:33:27 +02:00
parent a8d2961a79
commit 576c91a6a8
Signed by: evert
GPG Key ID: 1688DA83D222D0B5
4 changed files with 24 additions and 2 deletions

View File

@ -1,7 +1,18 @@
{% extends "base.html" %} {% extends "base.html" %}
{% block title %} {% block title %}
Episode "{{episode.name}}" - S{{episode.season.number}}E{{episode.episode}} - {{show.name}} - Episodes.Community Episode "{{episode.name}}" - S{{episode.season.number}}E{{episode.episode}} - {{show.name}} - Episodes.Community
{% endblock %} {% endblock %}
{% block meta %}
{{ block.super }}
<meta property="og:title" content="{{episode.name}}">
<meta property="og:type" content="video.episode">
<meta property="og:video:series" content="{{show.name}}">
<meta property="og:image" content="/media/uploaded_resources/{{show.banner}}">
<meta property="og:url" content="https://{{show.abbr}}.episodes.community/episode/{{episode.season.number}}/{{episode.episode}}-{{episode.name|slugify}}">
{% endblock %}
{% block content %} {% block content %}
<section class="show-details"> <section class="show-details">
<div class="banner" style="background-image: url(/media/uploaded_resources/{{show.banner}});"></div> <div class="banner" style="background-image: url(/media/uploaded_resources/{{show.banner}});"></div>
@ -21,6 +32,8 @@
<a href="/show/{{show.abbr}}" class="button"><i class="fa fa-fw fa-home"></i>&nbsp;Show Index</a> <a href="/show/{{show.abbr}}" class="button"><i class="fa fa-fw fa-home"></i>&nbsp;Show Index</a>
{% if request.session.user_id %} {% if request.session.user_id %}
<a href="/show/{{show.abbr}}/episode/{{episode.season.number}}/{{episode.episode}}/submit" class="button"><i class="fa fa-fw fa-plus"></i>&nbsp;Submit New Link</a> <a href="/show/{{show.abbr}}/episode/{{episode.season.number}}/{{episode.episode}}/submit" class="button"><i class="fa fa-fw fa-plus"></i>&nbsp;Submit New Link</a>
{% else %}
<span class="fillertext"><a href="/login">Log in</a> to submit a link</span>
{% endif %} {% endif %}
<h1>Watch <q>{{episode.name}}</q> From</h1> <h1>Watch <q>{{episode.name}}</q> From</h1>
<div class="submission-list"> <div class="submission-list">

View File

@ -2,6 +2,15 @@
{% block title %} {% block title %}
Watch {{show.name}} Now - on Episodes.Community! Watch {{show.name}} Now - on Episodes.Community!
{% endblock %} {% endblock %}
{% block meta %}
{{ block.super }}
<meta property="og:title" content="{{show.name}}">
<meta property="og:type" content="video.tv_show">
<meta property="og:image" content="/media/uploaded_resources/{{show.banner}}">
<meta property="og:url" content="https://{{show.abbr}}.episodes.community/">
{% endblock %}
{% block content %} {% block content %}
<section class="show-details"> <section class="show-details">
<div class="banner" style="background-image: url(/media/uploaded_resources/{{show.banner}});"></div> <div class="banner" style="background-image: url(/media/uploaded_resources/{{show.banner}});"></div>

View File

@ -1,6 +1,6 @@
{% extends "base.html" %} {% extends "base.html" %}
{% block title %} {% block title %}
Episode "{{episode.name}}" - S{{episode.season.number}}E{{episode.episode}} - {{show.name}} - Episodes.Community Submit a link - S{{episode.season.number}}E{{episode.episode}} - {{show.name}} - Episodes.Community
{% endblock %} {% endblock %}
{% block content %} {% block content %}
<section class="show-details"> <section class="show-details">

View File

@ -63,7 +63,7 @@ class EpisodeView(TemplateView):
if not episode: if not episode:
raise Http404("Episode does not exist") raise Http404("Episode does not exist")
# I aknowledge that this is a mess. A functional mess. But a mess nonetheless. Hey, that rhymed! # I acknowledge that this is a mess. A functional mess. But a mess nonetheless. Hey, that rhymed!
submissions = episode.submissions.annotate( submissions = episode.submissions.annotate(
positives=Count( positives=Count(
Case( Case(