changeset 9:9a40cc297133

Added backlinks
author Radomir Dopieralski <devel@sheep.art.pl>
date Sun, 16 Dec 2007 01:24:12 +0100
parents f84deed6b831
children 41f66b62103d
files mandarin.py mandarin/style.css
diffstat 2 files changed, 18 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mandarin.py	Sun Dec 16 01:17:51 2007 +0100
+++ b/mandarin.py	Sun Dec 16 01:24:12 2007 +0100
@@ -235,9 +235,19 @@
 
     def title(self, d):
         title = d['title_text']
+        _ = self.request.getText
         if title == d['page_name']:
-            html = '%s%s' % (
-                    self.pagepath(d),  wikiutil.escape(title.split('/')[-1]))
+            html = self.pagepath(d)
+            link_text = title.split('/')[-1]
+            link_title = _('Click to do a full-text search for this title', formatted=False)
+            link_query = {
+                'action': 'fullsearch',
+                'value': 'linkto:"%s"' % d['page_name'],
+                'context': '180',
+            }
+            # we dont use d['title_link'] any more, but make it ourselves:
+            link = d['page'].link_to(self.request, link_text, querystr=link_query, title=link_title, css_class='backlink', rel='nofollow')
+            html += link
         else:
             html = wikiutil.escape(title)
         return html
--- a/mandarin/style.css	Sun Dec 16 01:17:51 2007 +0100
+++ b/mandarin/style.css	Sun Dec 16 01:24:12 2007 +0100
@@ -167,6 +167,12 @@
     border-top: 2px solid #333;
     letter-spacing: 0.025em;
 }
+div.header h1 a.backlink {
+    color: #eee;
+}
+div.header h1 a.backlink:hover {
+    color: #fff;
+}
 
 span.pagepath { 
     font-size: 80%; color: #666;