Mercurial > public > sg101
changeset 487:77d878acea5e
For #233; add social media sharing buttons to podcast pages.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Wed, 19 Oct 2011 00:05:54 +0000 |
parents | 7854d75427af |
children | a747215e9a5a |
files | gpp/podcast/models.py gpp/templates/podcast/detail.html |
diffstat | 2 files changed, 24 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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, + }
--- 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 %} <link type="text/css" href="{{ STATIC_URL }}js/jplayer/skins/blue.monday/jplayer.blue.monday.css" rel="stylesheet" /> {% endblock %} {% block custom_js %} +{% script_tags "social" %} <script type="text/javascript" src="{{ STATIC_URL }}js/jplayer/jquery.jplayer.min.js"></script> <script type="text/javascript"> @@ -74,4 +80,5 @@ </li> {% endif %} </ul> +{% social_sharing podcast.search_title podcast.get_absolute_url %} {% endblock %}