From c51f34ca357f8a1e42b89428edb1fe4168d27c30 Mon Sep 17 00:00:00 2001 From: James Panther <4462786+jpanther@users.noreply.github.com> Date: Tue, 17 Aug 2021 11:03:22 +1000 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20incorrect=20URL=20when=20d?= =?UTF-8?q?eploying=20to=20a=20subfolder?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 7 +++++ exampleSite/config.toml | 5 ++-- layouts/partials/head.html | 8 +++--- layouts/partials/header.html | 2 +- layouts/shortcodes/figure.html | 52 ++++++++++++++-------------------- 5 files changed, 37 insertions(+), 37 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f303543b..87b4be32 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 --- +## [Unreleased] + +### Fixed + +- Fixes URLs being incorrect in some cases when the site is deployed in a subfolder + ## [1.0.0] - 2020-08-16 ### Initial release 🎉 @@ -30,4 +36,5 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Advanced customisation using simple Tailwind colour definitions and styles - Fully documented +[unreleased]: https://github.com/jpanther/Congo/compare/v1.0.0...HEAD [1.0.0]: https://github.com/jpanther/Congo/releases/tag/v1.0.0 diff --git a/exampleSite/config.toml b/exampleSite/config.toml index 97990d99..bb9f7327 100755 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -4,14 +4,15 @@ # as it does not contain all the required theme settings! # # Refer to the theme docs for configuration instructions if you're unsure. -# https://github.com/jpanther/Congo#readme +# https://jpanther.github.io/Congo/docs/ # -------------------------------------------------------------------------- -baseURL = "https://example.com" +baseURL = "https://jpanther.github.io/Congo/" theme = "Congo" languageCode = "en-AU" title = "Congo" enableEmoji = true +relativeURLs = true [author] name = "Congo" diff --git a/layouts/partials/head.html b/layouts/partials/head.html index f9fb7ad1..d53a5705 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -35,10 +35,10 @@ {{ if templates.Exists "partials/favicons.html" }} {{ partialCached "favicons.html" .Site }} {{ else }} - - - - + + + + {{ end }} {{/* Site Verification */}} {{ with .Site.Params.verification.google }} diff --git a/layouts/partials/header.html b/layouts/partials/header.html index 10dca7f9..4637df64 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -6,7 +6,7 @@ diff --git a/layouts/shortcodes/figure.html b/layouts/shortcodes/figure.html index c1de4995..ac0f6ab2 100644 --- a/layouts/shortcodes/figure.html +++ b/layouts/shortcodes/figure.html @@ -1,37 +1,29 @@ {{ if .Get "src" }} {{ $image := .Page.Resources.GetMatch (printf "*%s*" (.Get "src")) }} - - {{- if .Get "link" -}} - - {{- end -}} - {{ with .Get - {{- if .Get "link" }}{{ end -}} - {{- if or (or (.Get "title") (.Get "caption")) (.Get "attr") -}} -
- {{ with (.Get "title") -}} -

{{ . }}

- {{- end -}} - {{- if or (.Get "caption") (.Get "attr") -}}

- {{- .Get "caption" | markdownify -}} - {{- with .Get "attrlink" }} - - {{- end -}} - {{- .Get "attr" | markdownify -}} - {{- if .Get "attrlink" }}{{ end }}

- {{- end }} -
+ + {{- if .Get "link" -}} + + {{- end -}} + {{ with .Get + {{- if .Get "link" }}{{ end -}} + {{- if or (or (.Get "title") (.Get "caption")) (.Get "attr") -}} +
+ {{ with (.Get "title") -}}

{{ . }}

{{- end -}} + {{- if or (.Get "caption") (.Get "attr") -}}

+ {{- .Get "caption" | markdownify -}} + {{- with .Get "attrlink" }}{{- end -}} + {{- .Get "attr" | markdownify -}} + {{- if .Get "attrlink" }}{{ end }}

{{- end }} +
+ {{- end }} {{ end }} - - - -