#!/bin/rc rfork en ramfs d=`{basename -d $0} cd $d/.. subdirs=`{walk -d | grep -v '^(lib|img|up)($|/)'} fn lastupdated{ ts=`{mtime $1^.^* | grep -v '\.html$' | sort -dr | awk '{print $1; exit}'} date -u $ts } { echo '# Latest changes' ls -t *.md $subdirs^/*.md | $d/hidden | while(md=`{read}){ page=`{echo $md | sed 's/\.md$//'} html=$page^.html echo '* ['^$html^']('^$html^')' `{lastupdated $page} } } >changes.md { echo '# Sitemap' ls *.md $subdirs^/*.md | sort -d | $d/hidden | while(md=`{read}){ page=`{echo $md | sed 's/\.md$//'} html=$page^.html echo '* ['^$html^']('^$html^')' } } >sitemap.md { dom=`{ndb/query sys $sysname dom} if(~ $#dom 0) dom=$sysname echo '# Sitemap' ls *.md $subdirs^/*.md | sort -d | $d/hidden | while(md=`{read}){ page=`{echo $md | sed 's/\.md$//'} if(test -e $page^'.gmi'){ proto=gemini ext=.gmi } if not if(test -e $page^'.html'){ proto=http ext=.html } if not{ proto=gemini ext=.md } echo '=> '^$proto^'://'^$dom^/^$page^$ext^' '^$page^$ext } } >sitemap.gmi $d/mkpage changes >changes.html $d/mkpage sitemap >sitemap.html