diff --git a/tpl/sitemap.tpl b/tpl/sitemap.tpl
index 334f7e5..b84d209 100644
--- a/tpl/sitemap.tpl
+++ b/tpl/sitemap.tpl
@@ -2,6 +2,7 @@
%{
tmpfile=/tmp/werc_sitemap_$pid.txt
+tmpfilex=/tmp/werc_sitemapx_$pid.txt
saveddf=$dirfilter
fn listDir {
@@ -21,6 +22,7 @@ fn listDir {
n=`{echo /$u|sed 's/[\-_]/ /g; s,.*/([^/]+)/?$,\1,'}
echo '
'^$"n^'' $"desc ''
echo $base_url^$u >> $tmpfile
+ echo ''$base_url^$u'' >> $tmpfilex
if(test -d $i)
@{ listDir $i }
}
@@ -28,9 +30,30 @@ fn listDir {
}
}
+
fltr_cache listDir $sitedir/
-if(test -s $tmpfile)
+if(test -s $tmpfile) {
mv $tmpfile $sitedir/sitemap.txt &
+}
+if not if(test -f $tmpfile)
+ rm $tmpfile
+
+if(test -s $tmpfilex) {
+ {
+ echo '
+'
+
+ cat $tmpfilex
+ rm $tmpfilex &
+ echo ''
+ # TODO Enable automaic search engine update notification.
+ #hget 'http://google.com/ping?sitemap='^`{url_encode $base_url'/sitemap.gz'} > /dev/null
+
+ } | gzip > $sitedir/sitemap.gz &
+ #} > $sitedir/sitemap.xml &
+}
+if not if(test -f $tmpfilex)
+ rm $tmpfilex
%}