shithub: werc

Download patch

ref: 75872ff20214c2d9276032934961dbf5fc68fe34
parent: 19649f556cc7781acfce5ba473d60e44e3904401
author: uriel <uriel@suckless.org>
date: Mon Jul 7 11:19:52 EDT 2008

Autogenerate robots.txt files pointing to sitemap.txt

--- a/bin/gensitemaptxt.rc
+++ b/bin/gensitemaptxt.rc
@@ -4,4 +4,10 @@
 echo $d
 9 du -a $d | awk '/\.(md|html)$/ { print $2 }; {}' | 9 sed -e 's/\.(md|html)$//' -e 's,/index$,/,' -e 's,^sites/,http://,' > $d/sitemap.txt
 
+if(! test -f $d/robots.txt) {
+	echo generating missing robots.txt for $d
+	echo $d|sed 's,sites/,Sitemap: http://,; s/$/sitemap.txt/;' > $d/robots.txt
+	cat $d/robots.txt
+}
+
 }