diff options
author | dakkar <dakkar@thenautilus.net> | 2009-08-18 15:58:34 +0200 |
---|---|---|
committer | dakkar <dakkar@thenautilus.net> | 2009-08-18 15:58:34 +0200 |
commit | f3e2a9cb7be8e4e58637ec51985223b10960defe (patch) | |
tree | 5bc2c2f4394376dd59b12844be294b588a246ef0 /templates | |
parent | creation date is UTC, not local (diff) | |
download | thenautilus-f3e2a9cb7be8e4e58637ec51985223b10960defe.tar.gz thenautilus-f3e2a9cb7be8e4e58637ec51985223b10960defe.tar.bz2 thenautilus-f3e2a9cb7be8e4e58637ec51985223b10960defe.zip |
better feeds
- create feeds for news tags
- don't use namespace prefixes in feeds
- create good Ids for everything
Diffstat (limited to 'templates')
-rw-r--r-- | templates/base-feed.tt | 2 | ||||
-rw-r--r-- | templates/fillFeed.xsl | 51 |
2 files changed, 27 insertions, 26 deletions
diff --git a/templates/base-feed.tt b/templates/base-feed.tt index a7b34a3..2911d71 100644 --- a/templates/base-feed.tt +++ b/templates/base-feed.tt @@ -7,7 +7,7 @@ [% tag='';IF (matches = path.match('^(?:.*/)?tags/(.*)$')); tag = matches.0; END -%] <?xml version="1.0" encoding="utf-8"?> <a:feed xmlns:a="http://www.w3.org/2005/Atom"> -<a:tag>[% tag %] ( [% path %] )</a:tag> +<a:id>tag:thenautilus.net,2009-08-18:tags/[% tag %]/feed.[% language %].xml</a:id> <a:updated>[% l=docs.last;df.format(changed.$l.last_change) %]Z</a:updated> [% FOR doc IN docs; NEXT UNLESS isLang(language,doc) -%] [% IF tag; diff --git a/templates/fillFeed.xsl b/templates/fillFeed.xsl index 593ff51..a05e630 100644 --- a/templates/fillFeed.xsl +++ b/templates/fillFeed.xsl @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="utf-8"?> <x:stylesheet xmlns:x="http://www.w3.org/1999/XSL/Transform" xmlns:wc="http://webcoso.thenautilus.net/" + xmlns="http://www.w3.org/2005/Atom" xmlns:a="http://www.w3.org/2005/Atom" - xmlns="http://www.w3.org/1999/xhtml" - exclude-result-prefixes="wc" + exclude-result-prefixes="wc a" version="1.0"> <x:import href="du2html.xsl"/> @@ -15,43 +15,44 @@ <x:output method="xml" encoding="utf-8" doctype-public=""/> <x:template match="a:feed"> - <a:feed xml:lang="{$language}" xml:base="http://www.thenautilus.net/"> - <a:author> - <a:name>Gianni Ceccarelli</a:name> - <a:email>dakkar@thenautilus.net</a:email> - </a:author> - <a:id>http://www.thenautilus.net/</a:id> - <a:link rel="alternate" type="text/html" href="http://www.thenautilus.net{wc:dst-uri-for($filename)}"/> - <a:title type="text">thenautilus.net</a:title> - <x:copy-of select="a:updated"/> + <feed xml:lang="{$language}" xml:base="http://www.thenautilus.net/"> + <author> + <name>Gianni Ceccarelli</name> + <email>dakkar@thenautilus.net</email> + </author> + <id><x:value-of select="a:id"/></id> + <link rel="alternate" type="text/html" href="http://www.thenautilus.net{wc:dst-uri-for($filename)}"/> + <link rel="self" type="application/atom+xml" href="http://www.thenautilus.net{wc:dst-uri-for($filename)}feed.{$language}.xml"/> + <title type="text">thenautilus.net</title> + <updated><x:value-of select="a:updated"/></updated> <x:apply-templates select="a:entry"/> - </a:feed> + </feed> </x:template> <x:template match="a:entry"> - <a:entry> - <x:copy-of select="a:id"/> - <x:copy-of select="a:published"/> - <x:copy-of select="a:updated"/> + <entry> + <id><x:value-of select="a:id"/></id> + <published><x:value-of select="a:published"/></published> + <updated><x:value-of select="a:updated"/></updated> <x:apply-templates select="a:PH"/> - </a:entry> + </entry> </x:template> <x:template match="a:PH"> - <a:link rel="alternate" type="text/html" href="{.}"/> - <a:title type="xhtml"> - <div xml:base="{.}"> + <link rel="alternate" type="text/html" href="{.}"/> + <title type="xhtml"> + <div xml:base="{.}" xmlns="http://www.w3.org/1999/xhtml"> <x:apply-templates select="wc:title-for($language,$filename,.)/node()"/> </div> - </a:title> - <a:content type="xhtml"> - <div xml:base="{.}"> + </title> + <content type="xhtml"> + <div xml:base="{.}" xmlns="http://www.w3.org/1999/xhtml"> <x:apply-templates select="wc:document($language,$filename,.)/document/node()"/> </div> - </a:content> + </content> <x:for-each select="wc:document($language,$filename,.)/document/docinfo/field[field_name='tags']/field_body"> <x:for-each select="*/list_item|paragraph"> - <a:category term="{normalize-space(.)}" label="{normalize-space(string(wc:title-for($language,$filename,concat('/tags/',normalize-space(.),'/'))))}"/> + <category term="{normalize-space(.)}" label="{normalize-space(string(wc:title-for($language,$filename,concat('/tags/',normalize-space(.),'/'))))}"/> </x:for-each> </x:for-each> </x:template> |