From bbea1befdb1e78763979df676e6970139ce1ca5c Mon Sep 17 00:00:00 2001 From: Alice <84906+wheresalice@users.noreply.github.com> Date: Sun, 21 May 2023 19:22:50 +0100 Subject: [PATCH] Use relative path for CSS (#16) We should use a relative path for the CSS URL for sites that do not run from the root path (eg. https://example.com/mywebsite) --- .github/scripts/update-readable-css.sh | 7 +++---- layouts/partials/head.html | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/scripts/update-readable-css.sh b/.github/scripts/update-readable-css.sh index 90f0cae..0489432 100755 --- a/.github/scripts/update-readable-css.sh +++ b/.github/scripts/update-readable-css.sh @@ -23,9 +23,9 @@ echo "Latest tag: ${TAG_VERSION}" # the right numbers in the file. # We use sed to get rid of the readable.min.css prefix. CURRENT_VERSION=$(grep -o \ - 'readable.min.css?v=[[:digit:]]\+\.[[:digit:]]\+\.[[:digit:]]\+' \ + 'readable.min.css?v=v[[:digit:]]\+\.[[:digit:]]\+\.[[:digit:]]\+' \ layouts/partials/head.html \ - | sed 's/readable.min.css?v=/v/') + | sed 's/readable.min.css?v=//') echo "Current version: ${CURRENT_VERSION}" if [[ $TAG_VERSION == $CURRENT_VERSION ]] @@ -34,8 +34,7 @@ then else curl -s "https://codeberg.org/Freedom-to-Write/readable.css/raw/tag/${TAG_VERSION}/readable.css" > static/css/readable.css curl -s "https://codeberg.org/Freedom-to-Write/readable.css/raw/tag/${TAG_VERSION}/readable.min.css" > static/css/readable.min.css - VERSION=$(echo "${TAG_VERSION}" | sed 's/v//') - sed -i "s/readable.min.css?v=.*/readable.min.css?v=${VERSION}\">/" layouts/partials/head.html + sed -i "s/readable.min.css?v=${CURRENT_VERSION}/readable.min.css?v=${TAG_VERSION}/" layouts/partials/head.html fi # Add the latest tag version to the workflow environment, so we can access diff --git a/layouts/partials/head.html b/layouts/partials/head.html index c9fd2fa..1454f12 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -1,7 +1,7 @@ - + {{ if .Site.Params.favicon }}