# HG changeset patch # User Brian Neal # Date 1318982754 0 # Node ID 77d878acea5e470525801007f48e3a393a067afb # Parent 7854d75427af4c49675bd5aa27b0efe000e6cf2d For #233; add social media sharing buttons to podcast pages. diff -r 7854d75427af -r 77d878acea5e gpp/podcast/models.py --- a/gpp/podcast/models.py Tue Oct 18 23:23:42 2011 +0000 +++ b/gpp/podcast/models.py Wed Oct 19 00:05:54 2011 +0000 @@ -79,3 +79,20 @@ def search_summary(self): return u"\n".join((self.subtitle, self.summary, self.keywords)) + + def ogp_tags(self): + """ + Returns a dict of Open Graph Protocol meta tags. + + """ + title = "%s: %s; %s" % (self.channel.title, self.title, self.subtitle) + return { + 'og:title': title, + 'og:type': 'article', + 'og:url': self.get_absolute_url(), + 'og:description': self.subtitle, + 'og:audio': self.enclosure_url, + 'og:audio:title': title, + 'og:audio:artist': 'Various', + 'og:audio:type': self.enclosure_type, + } diff -r 7854d75427af -r 77d878acea5e gpp/templates/podcast/detail.html --- a/gpp/templates/podcast/detail.html Tue Oct 18 23:23:42 2011 +0000 +++ b/gpp/templates/podcast/detail.html Wed Oct 19 00:05:54 2011 +0000 @@ -1,10 +1,16 @@ {% extends 'podcast/base.html' %} {% load url from future %} +{% load script_tags %} +{% load core_tags %} {% block title %}Podcast: {{ podcast.title }}{% endblock %} +{% block custom_meta %} +{% open_graph_meta_tags podcast %} +{% endblock %} {% block custom_css %} {% endblock %} {% block custom_js %} +{% script_tags "social" %}