diff --git a/tpl/sitemap.tpl b/tpl/sitemap.tpl
index c83d015..b99325f 100644
--- a/tpl/sitemap.tpl
+++ b/tpl/sitemap.tpl
@@ -15,6 +15,7 @@ fn get_mdate {
}
fn get_children {
+ d=$1
children = `{ls -dF $d^*/ $d^*.md $d^*.html $d^*.txt >[2]/dev/null | sed $dirfilter}
echo $children
}
@@ -27,29 +28,51 @@ fn listDir {
. $d/_werc/config
if(~ $#perm_redir_to 0) {
- echo '
'
- siblings=`{ls -dF $d^*/ $d^*.md $d^*.html $d^*.txt >[2]/dev/null | sed $dirfilter}
+ siblings=`{get_children $d}
numsiblings = $#siblings
+ if(! ~ $numsiblings 0 && ! ~ $numsiblings 1){
+ echo ''
+ }
for(i in $siblings) {
+ ownchildren= `{get_children $i}
+ numownchildren=$#ownchildren
filename=`{get_file_title $i}
url=`{echo $i|sed 's!'$sitedir'!!; '$dirclean's!/index$!/!; '}
dirname=`{echo /$url|sed 's/[\-_]/ /g; s,.*/([^/]+)/?$,\1,'}
+
+ ## Open list?
+ if(! ~ $numsiblings 1){
+ echo '- '
+ }
+
if(! ~ $#filename 0 && ! ~ $filename '') {
# filename=' — '$"filename
- echo '
- '^$"filename^'
'
- echo $numsiblings
+ echo ''^$"filename^''
}
if not {
if(! ~ $"dirname $filtereddirs)
- echo '- '^$"dirname^'
'
- echo $numsiblings
+ echo ''^$"dirname^''
}
+
+ ## echo $numsiblings' '$numownchildren
+ ## ^ Useful for debugging purposes.
+
+ ## Close list?
+ if(! ~ $numownchildren 1){
+ echo ''
+ }
+ if not {
+ echo '/'
+ }
+
echo $base_url^$url >> $tmpfile
echo ''$base_url^$url''^`{get_mdate $i}^'' >> $tmpfilex
if(test -d $i)
@{ listDir $i }
}
- echo '
'
+ if(! ~ $numsiblings 0 && ! ~ $numsiblings 1){
+ echo '
'
+ }
}
}