summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--default-files/sitemap.xml14
-rw-r--r--html-gen.sh13
-rw-r--r--install.sh5
3 files changed, 32 insertions, 0 deletions
diff --git a/default-files/sitemap.xml b/default-files/sitemap.xml
new file mode 100644
index 0000000..28bdcc7
--- /dev/null
+++ b/default-files/sitemap.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<urlset xmllns="http://www.sitemaps.org/schemas/sitemap/0.9"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
+<?fugitive foreach:article ?>
+ <url>
+ <loc><?fugitive blog_url ?><?fugitive article_file ?>.html</loc>
+ <lastmod><?fugitive article_cdatetime ?></lastmod>
+<?fugitive ifset:article_mdatetime ?>
+ <lastmod><?fugitive article_mdatetime ?></lastmod>
+<?fugitive endifset:article_mdatetime ?>
+ </url>
+<?fugitive endforeach:article ?>
+</urlset>
diff --git a/html-gen.sh b/html-gen.sh
index 938a140..56f96fb 100644
--- a/html-gen.sh
+++ b/html-gen.sh
@@ -420,6 +420,19 @@ if [ $modification -gt 0 ]; then
cp "$temp" "$public_dir/atom.xml"
gzip -9kfn "$public_dir/atom.xml"
echo "done."
+ echo -n "[fugitive] Generating $public_dir/sitemap.xml... "
+ cat "$templates_dir/sitemap.xml" | \
+ replace_includes | \
+ replace_foreach "article" "$articles_sorted" | \
+ replace_foreach "commit" "$commits" | \
+ replace_empty_article_info | \
+ replace_str "page_title" "archives" | \
+ replace_str "blog_url" "$blog_url" | \
+ replace_commit_info "-1" | \
+ sed "/^[[:space:]]*$/d" > "$temp"
+ cp "$temp" "$public_dir/sitemap.xml"
+ gzip -9kfn "$public_dir/sitemap.xml"
+ echo "done."
rm "$last_5_articles" "$last_5_commits" "$temp"
echo -n "[fugitive] Using last published article as index page... "
cp "$public_dir/`head -1 $articles_sorted`.html" "$public_dir/index.html"
diff --git a/install.sh b/install.sh
index ee6bbd3..0b02a2f 100644
--- a/install.sh
+++ b/install.sh
@@ -71,10 +71,12 @@ _public/index.html
_public/archives.html
_public/rss.xml
_public/atom.xml
+_public/sitemap.xml
_public/index.html.gz
_public/archives.html.gz
_public/rss.xml.gz
_public/atom.xml.gz
+_public/sitemap.xml.gz
EOF
echo "done."
if [ "$1" = "local" ]; then
@@ -100,6 +102,9 @@ EOF
fugitive_write_template > _templates/atom.xml <<EOF
#INCLUDE:default-files/atom.xml#
EOF
+ fugitive_write_template > _templates/sitemap.xml <<EOF
+#INCLUDE:default-files/sitemap.xml#
+EOF
echo "done."
echo -n "Writing default css files... "
(base64 -d | gunzip) > _public/fugitive.css <<EOF