Skip to content

Commit

Permalink
fixes for using git for sitemap/index setup
Browse files Browse the repository at this point in the history
  • Loading branch information
traceypooh committed Jul 9, 2024
1 parent 962a579 commit fec4b80
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
6 changes: 1 addition & 5 deletions .github/workflows/blogtini.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ jobs:
uses: actions/checkout@v4
with:
lfs: true
fetch-depth: 0
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Blogtini setup
Expand All @@ -65,11 +66,6 @@ jobs:
export DENO_INSTALL="/home/runner/.deno"
export PATH="$DENO_INSTALL/bin:$PATH"
# xxxcc
ls .git
git log -1 --format='%cI' -- about/index.html
git config remote.origin.url
# setup SEO headers & create sitemap
./_blogtini/bin/ssr.sh
if [ ! -e sitemap.xml ]; then ./_blogtini/bin/sitemap; fi
Expand Down
15 changes: 10 additions & 5 deletions bin/sitemap
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,16 @@ if [ ! -e config.yml ]; then
exit 1
fi

NAME=$(git config remote.origin.url |cut -f2 -d: |cut -d/ -f1)
REPO=$(git config remote.origin.url |cut -f2 -d: |cut -d/ -f2)

PREFIX=https://$NAME.github.io/$REPO
[ -e CNAME ] && PREFIX=https://$(cat CNAME)
if [ -e CNAME ]; then
PREFIX=https://$(cat CNAME)
else
# examples of remote.origin.url:
# https://github.com/traceypooh/blogtini
# github.com:traceypooh/blogtini
NAME=$(git config remote.origin.url |tr : / |rev |cut -d/ -f2 |rev)
REPO=$(git config remote.origin.url |tr : / |rev |cut -d/ -f1 |rev)
PREFIX=https://$NAME.github.io/$REPO
fi

function sitemap() {
OUTFILE=sitemap.xml
Expand Down

0 comments on commit fec4b80

Please sign in to comment.