Modified:
/trunk/rig3serv/src/rig/site/site_default.py
/trunk/rig3serv/templates/default/html_entry.html
/trunk/rig3serv/templates/default/html_index.html
=======================================
--- /trunk/rig3serv/src/rig/site/site_default.py Wed Feb 10 21:33:23 2010
+++ /trunk/rig3serv/src/rig/site/site_default.py Sat Feb 13 09:47:26 2010
@@ -816,10 +816,15 @@
keywords["date_iso"] = self._DateToIso(date)
keywords["tags"] = dict(tags)
keywords["categories"] = list(cats)
+ # anchorlink is always relative to the current page
anchorlink_url, anchorlink_name = self._AnchorLink(date.year,
date.month, title)
keywords["anchorlink_url"] = anchorlink_url
keywords["anchorlink_name"] = anchorlink_name
- keywords["permalink_url"] = self._SinglePermalink(date, title)
+ # the last segment of the permalink
+ permalink_url = self._SinglePermalink(date, title)
+ keywords["permalink_url"] = permalink_url
+ keywords["rel_permalink_url"] = permalink_url
+ keywords["abs_permalink_url"] = permalink_url
keywords["_cache_key"] = self._cache.GetKey(keywords)
return SiteItem(source_item,
@@ -848,6 +853,26 @@
if _html_img:
_keywords["sections"]["images"] = _html_img
+ if "curr_category" in _keywords:
+ # We need to update some keywords depending the current
category
+ # being generated.
+ curr_category = _keywords["curr_category"]
+ permalink_url = _keywords["permalink_url"]
+ categories = _keywords["categories"]
+
+ # relative permalink, relative to the current page.
+ # For an index, this links to the sub-category page if the
post has categories.
+ rel_permalink_url = (not curr_category) and (categories and
("cat/" + categories[0] + "/") or "") or ""
+ rel_permalink_url += permalink_url
+
+ # absolute permalink, if current url is defined
+ curr_url = _keywords["curr_url"]
+ abs_permalink_url = (curr_url or "") + rel_permalink_url
+
+ _keywords["rel_permalink_url"] = rel_permalink_url
+ _keywords["abs_permalink_url"] = abs_permalink_url
+
+ # Check the generator cache
_cache_key = [ _template, _keywords["_cache_key"] ]
if _extra_keywords:
_key_temp_dict = _extra_keywords.copy()
=======================================
--- /trunk/rig3serv/templates/default/html_entry.html Wed Feb 10 22:05:25
2010
+++ /trunk/rig3serv/templates/default/html_entry.html Sat Feb 13 09:47:26
2010
@@ -10,8 +10,11 @@
- sections: dict{string name: string content}, the HTML for the various
sections.
- Expected sections names: html (old html), en, fr and images.
- rel_base_url: string, Relative url to base of site. May be empty or
like ../../
-- permalink_name: string, the permalink simplified name, for anchors
-- permalink_url: string, the permalink URL relative to the base URL
+- anchorlink_name: string, the anchor simplified name
+- anchorlink_url: string, the anchor simplified URL
+- permalink_url: string, the last segment of the permalink
+- rel_permalink_url: string, the permalink relative to the current file
(index or category or single post)
+- abs_permalink_url: string, the absolute URL of the permalink
]]
<div class="entry">
@@ -19,7 +22,7 @@
<tr><td class="left-top"> </td>
<td class="title">
<a name="[[url anchorlink_name]]" title="Permalink to '[[html title]]'"><a
- href="[[raw (not curr_category) and (categories and ("cat/" +
categories[0] + "/") or "") or ""]][[raw permalink_url]]"
+ href="[[html rel_permalink_url]]"
title="Permalink to '[[html title]]'"
><span class="date">[[html date.strftime("%Y/%m/%d")]]</span>
[[html title]]
@@ -33,6 +36,13 @@
[[html date.strftime("%Y-%m-%d %H:%M")]]
[[if "author" in tags]]by [[html tags["author"].capitalize() ]][[end]]
[[if categories]]in [[html ", ".join([c.capitalize() for c in
categories])]][[end]]
+
+<span style="float:right">
+<!-- Facebook -->
+<a name="fb_share" type="button" share_url="[[html abs_permalink_url]]"
title="[[html title]]"
+ href="http://www.facebook.com/sharer.php">Share</a>
+<script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share"
type="text/javascript"></script>
+</span>
</div>
[[if "en" in sections]]
=======================================
--- /trunk/rig3serv/templates/default/html_index.html Sun Jul 27 22:00:07
2008
+++ /trunk/rig3serv/templates/default/html_index.html Sat Feb 13 09:47:26
2010
@@ -29,6 +29,11 @@
<title>[[html public_name]] - [[html title]]</title>
<link rel="stylesheet" type="text/css" href="[[url rel_base_url
+ "media/style.css"]]" />
<link rel="alternate" type="application/atom+xml" title="[[url title]] -
Atom" href="atom.xml" />
+
+ <!-- Facebook -->
+ <meta name="medium" content="blog" />
+ <meta name="title" content="[[html title]]" />
+ <meta name="description" content="[[html public_name]]" />
</head>
<body>