diff --git a/r2/r2/models/link.py b/r2/r2/models/link.py
index 50b0ce902..5238aca85 100644
--- a/r2/r2/models/link.py
+++ b/r2/r2/models/link.py
@@ -257,6 +257,7 @@ class Link(Thing, Printable):
from r2.lib.count import incr_counts
from r2.lib.media import thumbnail_url
from r2.lib.utils import timeago
+ from r2.lib.template_helpers import get_domain
saved = Link._saved(user, wrapped) if user else {}
hidden = Link._hidden(user, wrapped) if user else {}
@@ -317,6 +318,17 @@ class Link(Thing, Printable):
else:
item.nofollow = False
+ item.subreddit_path = item.subreddit.path
+ if c.cname:
+ item.subreddit_path = ("http://" +
+ get_domain(cname = (c.site == item.subreddit),
+ subreddit = False))
+ if c.site != item.subreddit:
+ item.subreddit_path += item.subreddit.path
+ item.domain_path = "/domain/%s" % item.domain
+ if item.is_self:
+ item.domain_path = item.subreddit_path
+
if c.user_is_loggedin:
incr_counts(wrapped)
diff --git a/r2/r2/templates/link.html b/r2/r2/templates/link.html
index 6c2967870..f7b77aece 100644
--- a/r2/r2/templates/link.html
+++ b/r2/r2/templates/link.html
@@ -26,6 +26,7 @@
%>
<%inherit file="printable.html"/>
+<%namespace file="utils.html" import="plain_link" />
<%def name="numcol()">
<% num = thing.num %>
@@ -81,18 +82,8 @@
%def>
<%def name="subreddit()" buffered="True">
- <%
- if c.cname:
- path = "http://" + get_domain(cname = (c.site == thing.subreddit),
- subreddit = (c.site != thing.subreddit))
- else:
- path = thing.subreddit.path
- endif
- %>
-
- ${thing.subreddit.name}
-
+ ${plain_link(thing.subreddit.name, thing.subreddit_path, sr_path = False,
+ cname = False, _class = "subreddit hover")}
@@ -115,8 +106,8 @@
<%def name="domain()">
- (${thing.domain})
-
+ (${plain_link(thing.domain, thing.domain_path, _sr_path = False)})
+
%def>
<%def name="tagline()">