Mercurial > public > sg101
changeset 549:c4696a0cbd3f
Altered the open graph meta tags tag to generate tags for the home page
when None is supplied as a parameter. Updated the home page template to use it.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Sun, 15 Jan 2012 13:27:37 -0600 |
parents | 2c281530dc9c |
children | 9beda24d558c |
files | gpp/core/templatetags/core_tags.py gpp/settings/base.py gpp/templates/home.html |
diffstat | 3 files changed, 18 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/gpp/core/templatetags/core_tags.py Sat Jan 14 14:59:51 2012 -0600 +++ b/gpp/core/templatetags/core_tags.py Sun Jan 15 13:27:37 2012 -0600 @@ -93,14 +93,24 @@ @register.inclusion_tag('core/open_graph_meta_tag.html') -def open_graph_meta_tags(item): +def open_graph_meta_tags(item=None): """ Generates Open Graph meta tags by interrogating the given item. + To generate tags for the home page, set item to None. """ site = Site.objects.get_current() - props = item.ogp_tags() + if item: + props = item.ogp_tags() + else: + props = { + 'og:title': site.name, + 'og:type': 'website', + 'og:url': 'http://%s' % site.domain, + 'og:description': settings.OGP_SITE_DESCRIPTION, + } + props['og:site_name'] = site.name props['fb:admins'] = settings.OGP_FB_ID
--- a/gpp/settings/base.py Sat Jan 14 14:59:51 2012 -0600 +++ b/gpp/settings/base.py Sun Jan 15 13:27:37 2012 -0600 @@ -294,6 +294,10 @@ ####################################################################### OGP_DEFAULT_IMAGE = 'http://surfguitar101.com/media/podcast/podcast_logo.jpg' OGP_FB_ID = '100001558124013' +OGP_SITE_DESCRIPTION = ('The premier community website for friends and fans of' + ' instrumental surf music. We have forums, podcasts, surf music news, an' + ' event calendar, and much more! The surf is always up at' + ' SurfGuitar101.com!') ####################################################################### # URL's of 3rd party Javascript and CSS files.
--- a/gpp/templates/home.html Sat Jan 14 14:59:51 2012 -0600 +++ b/gpp/templates/home.html Sun Jan 15 13:27:37 2012 -0600 @@ -1,6 +1,7 @@ {% extends 'base.html' %} {% load url from future %} {% load bulletin_tags %} +{% load core_tags %} {% load news_tags %} {% load weblinks_tags %} {% load downloads_tags %} @@ -9,6 +10,7 @@ {% load script_tags %} {% load cache %} {% block title %}Home{% endblock %} +{% block custom_meta %}{% open_graph_meta_tags %}{% endblock %} {% block custom_head %} <link rel="alternate" type="application/rss+xml" title="SurfGuitar101 News" href="{% url 'feeds-news' %}" /> {% endblock %}