File tree Expand file tree Collapse file tree 2 files changed +29
-0
lines changed
Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change 3636 - name : Build
3737 run : mdbook build
3838
39+ - name : Generate sitemap.xml
40+ shell : bash
41+ run : |
42+ set -euo pipefail
43+ BOOK_DIR="book"
44+ BASE_URL="${{ steps.pages.outputs.base_url }}"
45+ BASE_URL="${BASE_URL%/}"
46+ OUT="$BOOK_DIR/sitemap.xml"
47+
48+ {
49+ echo '<?xml version="1.0" encoding="UTF-8"?>'
50+ echo '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'
51+ } > "$OUT"
52+
53+ find "$BOOK_DIR" -name "*.html" \
54+ | sed "s|^$BOOK_DIR||" \
55+ | sed 's|/index.html$|/|' \
56+ | sed 's|\.html$||' \
57+ | sort -u \
58+ | while read -r path; do
59+ printf ' <url><loc>%s</loc></url>\n' "$BASE_URL$path" >> "$OUT"
60+ done
61+
62+ echo '</urlset>' >> "$OUT"
63+
3964 - name : Upload artifact
4065 uses : actions/upload-pages-artifact@v3
4166 with :
Original file line number Diff line number Diff line change 1+ User-agent: *
2+ Allow: /
3+
4+ Sitemap: https://cloudexit.escapecloud.io/sitemap.xml
You can’t perform that action at this time.
0 commit comments