hlfw.ca

hlfw

ref: 750161b0281a7a9bc8c361d78d22789e55c17811
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=()
	for(repo in `$nl{ls}){
		## sort by year, then strip the .md out
		name=`{echo $repo | sed 's/\.md//'}
		echo '<dt><a href="/blog/'$name'.html">'$name'</a></dt>'
		
	}
} | tee $tcache && mv $tcache $cache