ref: 64dd665d49494256e79eb481c2551b74ed52dddb
parent: 0ca872e5fcc90996e50f447a8717e3d11b3aaa43
author: uriel <uriel@engel.se.cat-v.org>
date: Thu Sep 25 07:04:57 EDT 2008
Dynamically generate a sitemap.txt when the sitemap page is requested
--- a/lib/sitemap.tpl
+++ b/lib/sitemap.tpl
@@ -1,7 +1,8 @@
<h1>Site map</h1>
%{
-
+p=`{pwd}
+tmpfile=$p/tmp/sitemap_$pid.txt
saveddf = $dirfilter
fn getMdDesc {
@@ -17,9 +18,11 @@
echo '<ul>'
- if (! ~ $#blogDirs 0 || ~ $1 blog Blog )
- echo ''
- if not {
+ # Don't hide blog dirs for now
+ #if (! ~ $#blogDirs 0 || ~ $1 */blog */Blog )
+ # echo ''
+ #if not
+ {
for ( i in `{ ls -d $d/*/ $d/*.md $d/*.html $d/*.txt >[2]/dev/null |sed $dirfilter^'/index$/d;' } ) {
desc = ''
@@ -38,7 +41,8 @@
if (! ~ $desc '')
desc = ' - '$"desc
tit = `{basename $i|sed 's/_/ /g'}
- echo '<li><a style="text-transform: capitalize" href="'$i'">'^$"tit^'</a>' $desc '</li>'
+ echo '<li><a style="text-transform: capitalize" href="/'$i'">'^$"tit^'</a>' $desc '</li>'
+ echo $baseuri^$i >> $tmpfile
if (test -d $i)
@{ listDir $i }
}
@@ -46,7 +50,10 @@
echo '</ul>'
}
-cd $sitedir
+cd $sitedir
listDir .
+
+cp $tmpfile ./sitemap.txt
+rm $tmpfile
%}