From 2566c0c13ecf001b4d1ab9e8ea94ae40ea771bd5 Mon Sep 17 00:00:00 2001 From: James Socol Date: Mon, 16 May 2011 17:46:35 -0700 Subject: [PATCH] Add canonical shorturls to the header. --- r2/r2/lib/pages/pages.py | 3 +++ r2/r2/templates/base.compact | 3 +++ r2/r2/templates/reddit.html | 4 ++++ 3 files changed, 10 insertions(+) diff --git a/r2/r2/lib/pages/pages.py b/r2/r2/lib/pages/pages.py index 629823b7d..d2f82a88e 100644 --- a/r2/r2/lib/pages/pages.py +++ b/r2/r2/lib/pages/pages.py @@ -797,6 +797,9 @@ class LinkInfoPage(Reddit): self.subtitle = subtitle + if self.link.shortlink: + self.shortlink = self.link.shortlink + # if we're already looking at the 'duplicates' page, we can # avoid doing this lookup twice if duplicates is None: diff --git a/r2/r2/templates/base.compact b/r2/r2/templates/base.compact index 9608b0061..00a578575 100644 --- a/r2/r2/templates/base.compact +++ b/r2/r2/templates/base.compact @@ -31,6 +31,9 @@ + %if hasattr(thing, "shortlink"): + + %endif ${self.Title()} diff --git a/r2/r2/templates/reddit.html b/r2/r2/templates/reddit.html index 698aa459c..9dc2d7e5c 100644 --- a/r2/r2/templates/reddit.html +++ b/r2/r2/templates/reddit.html @@ -62,6 +62,10 @@ %endif %endif + %if hasattr(thing, "shortlink"): + + %endif + %if c.allow_styles and c.site.stylesheet_contents: <% inline_stylesheet = ( len(c.site.stylesheet_contents) < 1024