Wie man Trackback Links in die Ausgaben einbaut

Ein Bild von mir

Münsterland.org

Der Python Community Server kann jetzt Trackback Pings annehmen. Hier folgt eine Beschreibung wie man diese Funktionen im Python Desktop Server nutzen kann. Seit der Version 0.4.21 ist das nicht mehr notwendig, die Templates wie hier beschrieben zu ändern, aber als Dokumentation habe ich das mal einfach online gelassen. Ab 0.4.21 ist das ganze jedenfalls fest in PyDS integriert.

Zuerst müssen die folgenden beiden Textbausteine angelegt werden:

Diese beiden Textbausteine müssen in das WeblogRendering.tmpl eingebaut werden. Hier ist mein Template:

#if $upstream.get('prefs','cancomment')
$macros.commentsScript()
#end if
#if $upstream.get('prefs','cantrackback')
$macros.trackbackScript()
#end if
<table border=0 width="100%">
#set lastdate = ''
#if $year and $month and $day
#set list = $current.getRecentPosts(year=$year, month=$month, day=$day, onhome=$onhome, category=$category)
#elif $year and $month
#set list = $current.getRecentPosts(year=$year, month=$month, onhome=$onhome, category=$category)
#else
#set list = $current.getRecentPosts(onhome=$onhome, category=$category)
#end if
#for $post in $list
#if $post.pubdate != $lastdate
#if $lastdate
</table>
</td></tr>
<tr><td>&nbsp;</td></tr>
#end if
<tr><td class="whitebox" colspan=2>
<table width="100%">
<tr><td><a href="$current.getCloudUrlForDay($post.pubtime,category=$category)">$post.pubdate</a></td></tr>
#set $lastdate = $post.pubdate
#else
<tr><td>&nbsp;</td></tr>
#end if
#if $post.title
<tr>
#if $post.link
<td><h3><a name="$post.id"></a><a href="$post.link">$post.title</a></h3></td>
#else
<td><h3><a name="$post.id"></a>$post.title</h3></td>
#end if
</tr>
#end if
<tr>
<td>
#if not($post.title)
<a name="$post.id"></a>
#end if
#if $post.rendered
$post.rendered</td>
#else
$post.text</td>
#end if
</tr>
#if $post.source
<tr><td colspan=2 align="right" class="smallfont">$_('Source:')
#if $post.sourceurl
<a target="_new" href="$post.sourceurl">$post.source</a>
#else
$post.source
#end if
</td></tr>
#end if
<tr><td align="left">
<span class="smallfont">
$_('posted at') $macros.Time($post.pubtime)
&nbsp;&nbsp;
$macros.weblogPermaLink($post.id, $post.pubtime, $category)
#if $upstream.get('prefs','cancomment')
&nbsp;&nbsp;
$macros.weblogCommentsLink($post.id, $post.pubtime, $category)
#end if
#if $upstream.get('prefs','cantrackback')
&nbsp;&nbsp;
$macros.weblogTrackbackLink($post.id, $post.pubtime, $category)
#end if
</span>
</td></tr>
#end for
#if $lastdate
</table>
</td></tr>
#end if
</table>

Hier für den Download der Datei klicken

Wenn die Trackbacklinks auch im RSS-Feed eingebaut werden sollen, sollte das RSSFeedRendering.tmpl wie folgt aussehen (das RSSFeedRendering.tmpl kann man nicht über die Oberfläche editieren, es ist nur in ~/.PyDS/template zu finden):

<?xml version="1.0" encoding="iso-8859-1"?>
<rss version="2.0"
   xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback"
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<channel>
<title>$current.getRSSTitle(category=$category)</title>
<link>$current.getStaticUrl(category=$category)</link>
<description>$current.getRSSDescription(category=$category)</description>
<language>$_PyDS.language</language>
<copyright>$_('Copyright') $request.year $prefs.getXML('private', 'name')</copyright>
<lastBuildDate>$current.getRSSNewestDate(category=$category)</lastBuildDate>
<generator>$tools.version</generator>
<managingEditor>$prefs.getXML('private','email')</managingEditor>
<webMaster>$prefs.getXML('private','email')</webMaster>
<category domain="http://www.weblogs.com/rssUpdates/changes.xml">rssUpdates</category>
#set $skipHours = $current.getRSSSkipHours(category=$category)
#if $skipHours
<skipHours>
#for $hour in $skipHours
<hour>$hour</hour>
#end for
</skipHours>
#end if
#for $item in $current.getRSSItems(category=$category)
<item>
#if $item.title
<title>$item.title</title>
#end if
#if $item.link
<link>$item.link</link>
#end if
<description>$item.description</description>
<guid>$item.guid</guid>
#if $upstream.get('prefs','cancomment')
<comments>$item.comments</comments>
#end if
#if $upstream.get('prefs','cantrackback')
<trackback:ping rdf:resource="$item.trackback"/>
#end if
<pubDate>$item.pubdate</pubDate>
#if $item.source and $item.sourceurl
<source url="$item.sourceurl">$item.source</source>
#end if
</item>
#end for
</channel>
</rss>

Hier für den Download der Datei klicken

letzte Änderung 2003-05-05 23:01:52

Mai
MoDiMiDoFrSaSo
    1 2 3 4
5 6 7 8 91011
12131415161718
19202122232425
262728293031 
Apr Jun

Hier wird beschrieben, wie man die Trackbacklinks in den Output einbaut. Das macht natürlich nur sinn, wenn der eigene Community-Server auch ein Python Community Server ist.




XML-Icon Briefumschlag

© 2003, Georg Bauer