hlfw.ca

hlfw

ref: 55d8df7bce993260e020c1db8f14fde4d2436c99
dir: /bloglist/

View raw version
#!/bin/rc -e

. /sys/lib/hlfw/common.rc

cd $1
shift

cache=/usr/web/cache/bloglist.cache
tcache=/usr/web/cache/bloglist.cache.tmp.$pid
if(test -e $cache && ! test $cache -older 1m){
	exec cat $cache
	exit
}

rfork ne
nl='
'

{
	prelude '' 'blog'
	echo '<h2>Blogs</h2>'

	udir=()
	echo '<nav><ul>'
	for(repo in `$nl{ls | sort -r}){
		## sort by year, then strip the .md out
		name=`{echo $repo | sed 's/\.md//'}
		echo '<li><a href="/blog/'$name'.html">'$name'</a></li>'
		
	}
	echo '</nav></ul>'
} | tee $tcache && mv $tcache $cache