🐛 Fix incorrect URL when deploying to a subfolder

pull/2/head
James Panther 2021-08-17 11:03:22 +10:00
parent 4267b32c4c
commit c51f34ca35
No known key found for this signature in database
GPG Key ID: D36F789E45745D17
5 changed files with 37 additions and 37 deletions

View File

@ -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 ## [1.0.0] - 2020-08-16
### Initial release 🎉 ### 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 - Advanced customisation using simple Tailwind colour definitions and styles
- Fully documented - 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 [1.0.0]: https://github.com/jpanther/Congo/releases/tag/v1.0.0

View File

@ -4,14 +4,15 @@
# as it does not contain all the required theme settings! # as it does not contain all the required theme settings!
# #
# Refer to the theme docs for configuration instructions if you're unsure. # 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" theme = "Congo"
languageCode = "en-AU" languageCode = "en-AU"
title = "Congo" title = "Congo"
enableEmoji = true enableEmoji = true
relativeURLs = true
[author] [author]
name = "Congo" name = "Congo"

View File

@ -35,10 +35,10 @@
{{ if templates.Exists "partials/favicons.html" }} {{ if templates.Exists "partials/favicons.html" }}
{{ partialCached "favicons.html" .Site }} {{ partialCached "favicons.html" .Site }}
{{ else }} {{ else }}
<link rel="apple-touch-icon" sizes="180x180" href="{{ "/apple-touch-icon.png" | absURL }}" /> <link rel="apple-touch-icon" sizes="180x180" href="{{ "apple-touch-icon.png" | absURL }}" />
<link rel="icon" type="image/png" sizes="32x32" href="{{ "/favicon-32x32.png" | absURL }}" /> <link rel="icon" type="image/png" sizes="32x32" href="{{ "favicon-32x32.png" | absURL }}" />
<link rel="icon" type="image/png" sizes="16x16" href="{{ "/favicon-16x16.png" | absURL }}" /> <link rel="icon" type="image/png" sizes="16x16" href="{{ "favicon-16x16.png" | absURL }}" />
<link rel="manifest" href="{{ "/site.webmanifest" | absURL }}" /> <link rel="manifest" href="{{ "site.webmanifest" | absURL }}" />
{{ end }} {{ end }}
{{/* Site Verification */}} {{/* Site Verification */}}
{{ with .Site.Params.verification.google }} {{ with .Site.Params.verification.google }}

View File

@ -6,7 +6,7 @@
<ul class="flex flex-col list-none sm:flex-row"> <ul class="flex flex-col list-none sm:flex-row">
{{ range .Site.Menus.main }} {{ range .Site.Menus.main }}
<li class="text-right sm:mr-7 sm:last:mr-0"> <li class="text-right sm:mr-7 sm:last:mr-0">
<a class="hover:underline" href="{{ .URL }}" title="{{ .Title }}">{{ .Name }}</a> <a class="hover:underline" href="{{ .URL | absURL }}" title="{{ .Title }}">{{ .Name }}</a>
</li> </li>
{{ end }} {{ end }}
</ul> </ul>

View File

@ -1,37 +1,29 @@
{{ if .Get "src" }} {{ if .Get "src" }}
{{ $image := .Page.Resources.GetMatch (printf "*%s*" (.Get "src")) }} {{ $image := .Page.Resources.GetMatch (printf "*%s*" (.Get "src")) }}
<figure{{ with .Get "class" }} class="{{ . }}"{{ end }}> <figure{{ with .Get "class" }} class="{{ . }}"{{ end -}}>
{{- if .Get "link" -}} {{- if .Get "link" -}}
<a href="{{ .Get "link" }}"{{ with .Get "target" }} target="{{ . }}"{{ end }}{{ with .Get "rel" }} rel="{{ . }}"{{ end }}> <a href="{{ .Get "link" }}"{{ with .Get "target" }} target="{{ . }}"{{ end }}{{ with .Get "rel" }} rel="{{ . }}"{{ end }}>
{{- end -}} {{- end -}}
<img src="{{ $image.RelPermalink }}" <img src="{{ $image.Permalink }}"
{{- if or (.Get "alt") (.Get "caption") }} {{- if or (.Get "alt") (.Get "caption") }}
alt="{{ with .Get "alt" }}{{ . }}{{ else }}{{ .Get "caption" | markdownify| plainify }}{{ end }}" alt="{{ with .Get "alt" }}{{ . }}{{ else }}{{ .Get "caption" | markdownify | plainify }}{{ end }}"
{{- end -}} {{- end -}}
{{- with .Get "width" }} width="{{ . }}"{{ end -}} {{- with .Get "width" }} width="{{ . }}"{{ end -}}
{{- with .Get "height" }} height="{{ . }}"{{ end -}} {{- with .Get "height" }} height="{{ . }}"{{ end -}}
/><!-- Closing img tag --> />
{{- if .Get "link" }}</a>{{ end -}} {{- if .Get "link" }}</a>{{ end -}}
{{- if or (or (.Get "title") (.Get "caption")) (.Get "attr") -}} {{- if or (or (.Get "title") (.Get "caption")) (.Get "attr") -}}
<figcaption> <figcaption>
{{ with (.Get "title") -}} {{ with (.Get "title") -}}<h4>{{ . }}</h4>{{- end -}}
<h4>{{ . }}</h4> {{- if or (.Get "caption") (.Get "attr") -}}<p>
{{- end -}} {{- .Get "caption" | markdownify -}}
{{- if or (.Get "caption") (.Get "attr") -}}<p> {{- with .Get "attrlink" }}<a href="{{ . }}">{{- end -}}
{{- .Get "caption" | markdownify -}} {{- .Get "attr" | markdownify -}}
{{- with .Get "attrlink" }} {{- if .Get "attrlink" }}</a>{{ end }}</p>
<a href="{{ . }}">
{{- end -}}
{{- .Get "attr" | markdownify -}}
{{- if .Get "attrlink" }}</a>{{ end }}</p>
{{- end }}
</figcaption>
{{- end }} {{- end }}
</figcaption>
{{- end }}
</figure> </figure>
{{ end }} {{ end }}