Mercurial > public > sg101
diff gpp/forums/models.py @ 556:70722b7d10af
For bitbucket issue #1, add open graph meta tags to forum topics.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Sun, 29 Jan 2012 14:42:42 -0600 |
parents | 9e42e6618168 |
children |
line wrap: on
line diff
--- a/gpp/forums/models.py Thu Jan 26 20:24:15 2012 -0600 +++ b/gpp/forums/models.py Sun Jan 29 14:42:42 2012 -0600 @@ -256,6 +256,22 @@ def search_summary(self): return u'' + def ogp_tags(self): + """ + Returns a dict of Open Graph Protocol meta tags. + + """ + desc = 'Forum topic created by %s on %s.' % ( + self.user.username, + self.creation_date.strftime('%B %d, %Y')) + + return { + 'og:title': self.name, + 'og:type': 'article', + 'og:url': self.get_absolute_url(), + 'og:description': desc, + } + class Post(models.Model): """