Generate sitemap.
authorOleksandr Gavenko <gavenkoa@gmail.com>
Thu, 04 Aug 2016 15:20:07 +0300
changeset 78 093ee7c2985f
parent 77 df763e1c3fe6
child 79 a0f224c26f08
Generate sitemap.
Makefile
--- a/Makefile	Wed Feb 24 21:50:25 2016 +0200
+++ b/Makefile	Thu Aug 04 15:20:07 2016 +0300
@@ -54,7 +54,7 @@
 ################################################################
 # Deploy targets.
 
-WWW_SRV_NAME := defun.work
+WWW_SRV_NAME := tips.defun.work
 WWW_SRV_USER := user
 HG_SRV_NAME := hg.defun.work
 HG_SRV_USER := user
@@ -69,7 +69,7 @@
 
 # Will be accessible via: http://tips.defun.work/
 .PHONY: deploy2defun-web
-deploy2defun-web: html
+deploy2defun-web: www
 	rsync --delete -avP -e ssh $(HTML_DIR)/ $(WWW_SRV_USER)@$(WWW_SRV_NAME):/srv/www/tips/
 
 .PHONY: deploy2defun-hg
@@ -78,7 +78,7 @@
 
 # Will be accessible via: http://gavenkoa.users.sourceforge.net/tips-html/
 .PHONY: deploy2sf-web
-deploy2sf-web: html
+deploy2sf-web: www
 	rsync --delete -avP -e ssh $(HTML_DIR)/ gavenkoa@frs.sourceforge.net:/home/user-web/g/ga/gavenkoa/htdocs/tips-html/
 
 .PHONY: deploy2sf-hg
@@ -95,6 +95,9 @@
 .PHONY: all
 all:
 
+.PHONY: www
+www: html $(HTML_DIR)/sitemap.xml
+
 .PHONY: html
 html: $(HTML_FILES)
 
@@ -151,6 +154,19 @@
 for f in *.rst; do echo ".. include:: ../$$f"; done; \
 } >$@
 
+$(HTML_DIR)/sitemap.xml: $(RST_FILES) $(MAKEFILE_LIST)
+	{ \
+echo '<?xml version="1.0" encoding="UTF-8"?>'; \
+echo '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'; \
+for f in *.rst iframe; do \
+  echo '<url>'; \
+  echo "  <loc>http://$(WWW_SRV_NAME)/$${f%.rst}.html</loc>"; \
+  echo '  <changefreq>weekly</changefreq>'; \
+  echo '</url>'; \
+done; \
+echo '</urlset>'; \
+} >$@
+
 ################################################################
 # Init targets.