commit 69378b1d76c386c1b1182c7c4bd21b1a88413bc3
parent b9817127a06b48e2772e76199555919c902fc345
Author: Matsuda Kenji <contact2655@matsudakenji.xyz>
Date: Tue, 14 Dec 2021 08:18:31 +0900
add sitemap.xml
Diffstat:
2 files changed, 51 insertions(+), 0 deletions(-)
diff --git a/bin/update b/bin/update
@@ -3,6 +3,7 @@
cd $(dirname $0)/..
man=$(pwd)/man
pub=$(pwd)/pub
+url="https://www.matsudakenji.xyz"
list_dirs(){
cd "$1" && eval "find . -type d ! -name '.' ! -path '*/_*'"
@@ -22,6 +23,21 @@ list_files_to_replace(){
fi
}
+render_sitemap(){
+ echo '<?xml version="1.0" encoding="UTF-8"?>'
+ echo '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'
+
+ (cd $pub && find . -name '*.html' | xargs ls -lT ) |
+ awk '{print $9 "-" $6 "-" $7, $10}' |
+ sed 's/\(^....-\)Jan/\11/;s/\(^....-\)Feb/\12/;s/\(^....-\)Mar/\11/;
+ s/\(^....-\)Apr/\14/;s/\(^....-\)May/\15/;s/\(^....-\)Jun/\16/;
+ s/\(^....-\)Jul/\17/;s/\(^....-\)Aug/\18/;s/\(^....-\)Sep/\19/;
+ s/\(^....-\)Oct/\110/;s/\(^....-\)Nov/\111/;s/\(^....-\)Dec/\112/;
+ s/\(^[^ ]* \)\./\1/; s;/index.html$;/;' |
+ sed 's;\(^....-..-..\) \(.*$\);<url><loc>'"$url"'\2</loc><lastmod>\1</lastmod></url>;'
+ echo '</urlset>'
+}
+
list_dirs "$man" | (cd "$man" && cpio -pdu "$pub")
fs=$(
if [ -f "$pub/.files" ]; then
@@ -43,3 +59,5 @@ fi
(cd $man && find .) | sed 's/^.*$/\! -path "&"/' | tr '\n' ' ' |
sed 's;^.*$;\(cd '$pub' \&\& find . \! -path ./.files & -delete\);' |
sh -s
+
+render_sitemap > "$pub/sitemap.xml"
diff --git a/pub/sitemap.xml b/pub/sitemap.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
+<url><loc>https://www.matsudakenji.xyz/about.html</loc><lastmod>2021-12-13</lastmod></url>
+<url><loc>https://www.matsudakenji.xyz/blog/blog_index.html</loc><lastmod>2021-12-13</lastmod></url>
+<url><loc>https://www.matsudakenji.xyz/blog/posts/20200719.html</loc><lastmod>2021-12-13</lastmod></url>
+<url><loc>https://www.matsudakenji.xyz/blog/posts/20200723.html</loc><lastmod>2021-12-13</lastmod></url>
+<url><loc>https://www.matsudakenji.xyz/blog/posts/20200725.html</loc><lastmod>2021-12-13</lastmod></url>
+<url><loc>https://www.matsudakenji.xyz/blog/posts/20200727.html</loc><lastmod>2021-12-13</lastmod></url>
+<url><loc>https://www.matsudakenji.xyz/blog/posts/20200801.html</loc><lastmod>2021-12-13</lastmod></url>
+<url><loc>https://www.matsudakenji.xyz/blog/posts/20200802.html</loc><lastmod>2021-12-13</lastmod></url>
+<url><loc>https://www.matsudakenji.xyz/blog/posts/20200804.html</loc><lastmod>2021-12-13</lastmod></url>
+<url><loc>https://www.matsudakenji.xyz/blog/posts/20200808.html</loc><lastmod>2021-12-13</lastmod></url>
+<url><loc>https://www.matsudakenji.xyz/blog/posts/20200917.html</loc><lastmod>2021-12-13</lastmod></url>
+<url><loc>https://www.matsudakenji.xyz/blog/posts/20200918.html</loc><lastmod>2021-12-13</lastmod></url>
+<url><loc>https://www.matsudakenji.xyz/blog/posts/20200919.html</loc><lastmod>2021-12-13</lastmod></url>
+<url><loc>https://www.matsudakenji.xyz/blog/posts/20200925.html</loc><lastmod>2021-12-13</lastmod></url>
+<url><loc>https://www.matsudakenji.xyz/blog/posts/20200926.html</loc><lastmod>2021-12-13</lastmod></url>
+<url><loc>https://www.matsudakenji.xyz/blog/posts/20201003.html</loc><lastmod>2021-12-13</lastmod></url>
+<url><loc>https://www.matsudakenji.xyz/blog/posts/20201201.html</loc><lastmod>2021-12-13</lastmod></url>
+<url><loc>https://www.matsudakenji.xyz/blog/posts/20201202.html</loc><lastmod>2021-12-13</lastmod></url>
+<url><loc>https://www.matsudakenji.xyz/blog/posts/20201209.html</loc><lastmod>2021-12-13</lastmod></url>
+<url><loc>https://www.matsudakenji.xyz/blog/posts/20201210.html</loc><lastmod>2021-12-13</lastmod></url>
+<url><loc>https://www.matsudakenji.xyz/blog/posts/20210106.html</loc><lastmod>2021-12-13</lastmod></url>
+<url><loc>https://www.matsudakenji.xyz/blog/posts/20210806.html</loc><lastmod>2021-12-13</lastmod></url>
+<url><loc>https://www.matsudakenji.xyz/blog/posts/20211129.html</loc><lastmod>2021-12-13</lastmod></url>
+<url><loc>https://www.matsudakenji.xyz/computer/archlinux_installation.html</loc><lastmod>2021-12-13</lastmod></url>
+<url><loc>https://www.matsudakenji.xyz/computer/what-i-use.html</loc><lastmod>2021-12-13</lastmod></url>
+<url><loc>https://www.matsudakenji.xyz/error/404.html</loc><lastmod>2021-12-13</lastmod></url>
+<url><loc>https://www.matsudakenji.xyz/farm/journal/2021.html</loc><lastmod>2021-12-13</lastmod></url>
+<url><loc>https://www.matsudakenji.xyz/</loc><lastmod>2021-12-13</lastmod></url>
+<url><loc>https://www.matsudakenji.xyz/misc/migration.html</loc><lastmod>2021-12-13</lastmod></url>
+<url><loc>https://www.matsudakenji.xyz/plants/myrica_rubra.html</loc><lastmod>2021-12-13</lastmod></url>
+</urlset>