commit 73cb339bc7ed4b628e70d6eac3696310090ee345
parent 4b969262a789bae6cfafe5160cfba34cf268e333
Author: Nuno Sempere <nuno.semperelh@protonmail.com>
Date: Tue, 26 Jul 2022 02:32:47 +0000
tweak: get working number of children
Diffstat:
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/tpl/sitemap.tpl b/tpl/sitemap.tpl
@@ -14,26 +14,35 @@ fn get_mdate {
echo $t(6)^'-'^$t(2)^'-'^$t(3)
}
+fn get_children {
+ children = `{ls -dF $d^*/ $d^*.md $d^*.html $d^*.txt >[2]/dev/null | sed $dirfilter}
+ echo $children
+}
+
fn listDir {
d=$1
dirfilter=$saveddf
+
if(test -f $d/_werc/config)
. $d/_werc/config
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}) {
+ siblings=`{ls -dF $d^*/ $d^*.md $d^*.html $d^*.txt >[2]/dev/null | sed $dirfilter}
+ numsiblings = $#siblings
+ for(i in $siblings) {
filename=`{get_file_title $i}
url=`{echo $i|sed 's!'$sitedir'!!; '$dirclean's!/index$!/!; '}
dirname=`{echo /$url|sed 's/[\-_]/ /g; s,.*/([^/]+)/?$,\1,'}
if(! ~ $#filename 0 && ! ~ $filename '') {
# filename=' — '$"filename
- echo '<li><a href="'$url'">'^$"filename^'</a></li>'
+ echo '<li><a href="'$url'">'^$"filename^'</a></li>'
+ echo $numsiblings
}
if not {
if(! ~ $"dirname $filtereddirs)
echo '<li><a href="'$url'">'^$"dirname^'</a></li>'
+ echo $numsiblings
}
echo $base_url^$url >> $tmpfile
echo '<url><loc>'$base_url^$url'</loc><lastmod>'^`{get_mdate $i}^'</lastmod></url>' >> $tmpfilex