2007-06-17 17:45:45 -06:00
|
|
|
<h1>Site map</h1>
|
|
|
|
|
|
|
|
%{
|
2008-09-26 06:48:31 -06:00
|
|
|
tmpfile=/tmp/werc_sitemap_$pid.txt
|
2009-07-28 17:41:18 -06:00
|
|
|
tmpfilex=/tmp/werc_sitemapx_$pid.txt
|
2008-12-20 05:20:31 -07:00
|
|
|
saveddf=$dirfilter
|
2007-06-17 17:45:45 -06:00
|
|
|
|
|
|
|
fn listDir {
|
2008-09-04 17:07:56 -06:00
|
|
|
d=$1
|
2008-12-20 05:20:31 -07:00
|
|
|
dirfilter=$saveddf
|
|
|
|
if(test -f $d/_werc/config)
|
|
|
|
. ./$d/_werc/config
|
2007-06-17 17:45:45 -06:00
|
|
|
|
2009-02-14 00:09:27 -07:00
|
|
|
if(~ $#perm_redir_to 0) {
|
|
|
|
echo '<ul class="sitemap-list">'
|
|
|
|
|
|
|
|
for(i in `{ls -dF $d^*/ $d^*.md $d^*.html $d^*.txt >[2]/dev/null | sed $dirfilter}) {
|
|
|
|
desc=`{get_file_title $i}
|
|
|
|
u=`{echo $i|sed 's!'$sitedir'!!; '$dirclean's!/index$!/!; '}
|
|
|
|
if(! ~ $#desc 0 && ! ~ $desc '')
|
|
|
|
desc=' - '$"desc
|
2009-07-19 00:01:42 -06:00
|
|
|
n=`{echo /$u|sed 's/[\-_]/ /g; s,.*/([^/]+)/?$,\1,'}
|
2009-07-24 19:11:15 -06:00
|
|
|
echo '<li><a href="'$u'">'^$"n^'</a>' $"desc '</li>'
|
2009-02-14 00:09:27 -07:00
|
|
|
echo $base_url^$u >> $tmpfile
|
2009-07-28 17:41:18 -06:00
|
|
|
echo '<url><loc>'$base_url^$u'</loc></url>' >> $tmpfilex
|
2009-02-14 00:09:27 -07:00
|
|
|
if(test -d $i)
|
|
|
|
@{ listDir $i }
|
|
|
|
}
|
|
|
|
echo '</ul>'
|
2007-06-25 20:25:20 -06:00
|
|
|
}
|
2007-06-17 17:45:45 -06:00
|
|
|
}
|
2008-09-04 17:07:56 -06:00
|
|
|
|
2009-07-28 17:41:18 -06:00
|
|
|
|
2009-02-06 14:09:32 -07:00
|
|
|
fltr_cache listDir $sitedir/
|
2007-06-17 17:45:45 -06:00
|
|
|
|
2009-07-28 17:41:18 -06:00
|
|
|
if(test -s $tmpfile) {
|
2009-02-06 12:43:11 -07:00
|
|
|
mv $tmpfile $sitedir/sitemap.txt &
|
2009-07-28 17:41:18 -06:00
|
|
|
}
|
|
|
|
if not if(test -f $tmpfile)
|
|
|
|
rm $tmpfile
|
|
|
|
|
|
|
|
if(test -s $tmpfilex) {
|
|
|
|
{
|
|
|
|
echo '<?xml version="1.0" encoding="UTF-8"?>
|
|
|
|
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'
|
|
|
|
|
|
|
|
cat $tmpfilex
|
|
|
|
rm $tmpfilex &
|
|
|
|
echo '</urlset>'
|
|
|
|
# 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
|
2008-09-25 03:04:57 -06:00
|
|
|
|
2007-06-17 17:45:45 -06:00
|
|
|
%}
|