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)
This commit is contained in:
Alice 2023-05-21 19:22:50 +01:00 committed by GitHub
parent 749aee44a0
commit bbea1befdb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 5 deletions

View File

@ -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

View File

@ -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. -->