hugo-theme-readable

Fork of https://github.com/cjtheham/hugo-theme-readable
git clone https://git.eamoncaddigan.net/hugo-theme-readable.git
Log | Files | Refs | README | LICENSE

commit bbea1befdb1e78763979df676e6970139ce1ca5c
parent 749aee44a01f50032be2ff4ab6a97048f085dce5
Author: Alice <84906+wheresalice@users.noreply.github.com>
Date:   Sun, 21 May 2023 19:22:50 +0100

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)
Diffstat:
M.github/scripts/update-readable-css.sh | 7+++----
Mlayouts/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 @@ -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 @@ -1,7 +1,7 @@ <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <!-- This ensures your site looks right on mobile devices --> - <link rel="stylesheet" type="text/css" href="/css/readable.min.css?v=1.1.0"> + <link rel="stylesheet" type="text/css" href="{{relURL "css/readable.min.css?v=v1.1.0"}}"> <meta name="description" content='{{ .Page.Description }}'> {{ if .Site.Params.favicon }} <link rel="shortcut icon" href="{{ relURL ($.Site.Params.favicon) }}" type="image/x-icon" /> <!-- Show a favicon for your site, if one is configured in the Params section of the config. -->