🏗️ Change URLs to be relative instead of absolute

pull/2/head
James Panther 2021-08-26 09:44:41 +10:00
parent 1a69b5fd39
commit f6dceb6233
No known key found for this signature in database
GPG Key ID: D36F789E45745D17
13 changed files with 23 additions and 23 deletions

View File

@ -9,6 +9,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Fathom Analytics script included twice when using custom domain
- Recent heading on homepage profile layout misaligned
### Changed
- URLs are relative by default which allows the theme to be more flexible in different deployment scenarios
## [1.2.0] - 2021-08-22
### Added
- Multiple colour schemes

View File

@ -12,7 +12,6 @@ languageCode = "en-AU"
defaultContentLanguage = "en"
title = "Congo"
enableEmoji = true
relativeURLs = true
[author]
name = "Congo"

View File

@ -6,7 +6,7 @@
<h2>
<a
class="text-xl font-medium hover:underline hover:underline-primary-500 hover:underline-offset-small"
href="{{ .Page.Permalink }}"
href="{{ .Page.RelPermalink }}"
>{{ .Page.Title }}</a
>
{{ if $.Site.Params.taxonomy.showTermCount | default true }}

View File

@ -17,7 +17,7 @@
{{ else }}
<a
class="hover:underline hover:underline-primary-500 hover:underline-offset-small text-neutral-800 dark:text-neutral"
href="{{ .Permalink }}"
href="{{ .RelPermalink }}"
>{{ .Title }}</a
>
{{ end }}

View File

@ -5,7 +5,7 @@
<div class="flex justify-between pt-3">
<span>
{{ if .NextInSection }}
<a class="flex" href="{{ .NextInSection.Permalink }}">
<a class="flex" href="{{ .NextInSection.RelPermalink }}">
<span class="mr-3 article-pagination-direction">&larr;</span>
<span class="flex flex-col">
<span class="article-pagination-title">{{ .NextInSection.Title }}</span>
@ -20,7 +20,7 @@
</span>
<span>
{{ if .PrevInSection }}
<a class="flex text-right" href="{{ .PrevInSection.Permalink }}">
<a class="flex text-right" href="{{ .PrevInSection.RelPermalink }}">
<span class="flex flex-col">
<span class="article-pagination-title">{{ .PrevInSection.Title }}</span>
<span class="-mt-1 text-xs text-neutral-400 dark:text-neutral-500">

View File

@ -1,7 +1,7 @@
{{ if .Params.showAuthor | default (.Site.Params.article.showAuthor | default true) }}
<div class="flex items-center">
{{ with .Site.Author.image }}
<img class="w-24 h-24 !mt-0 !mb-0 mr-4 rounded-full" src="{{ . | absURL }}" />
<img class="w-24 h-24 !mt-0 !mb-0 mr-4 rounded-full" src="{{ . | relURL }}" />
{{ end }}
<div>
{{ with .Site.Author.name }}

View File

@ -10,7 +10,7 @@
<li class="inline {{ if or (eq .p1 .p2) (.p1.IsHome) }}hidden{{ end }}">
<a
class="hover:underline hover:underline-neutral-300 dark:underline-neutral-600"
href="{{ .p1.Permalink }}"
href="{{ .p1.RelPermalink }}"
>{{ .p1.Title }}</a
><span class="px-1 text-primary-500">/</span>
</li>

View File

@ -24,7 +24,7 @@
{{- end }}
<link rel="canonical" href="{{ .Permalink }}" />
{{ range .AlternativeOutputFormats -}}
{{ printf `<link rel="%s" type="%s" href="%s" title="%s" />` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }}
{{ printf `<link rel="%s" type="%s" href="%s" title="%s" />` .Rel .MediaType.Type .RelPermalink $.Site.Title | safeHTML }}
{{ end -}}
{{/* Styles */}}
{{ $schemeCSS := resources.Get (printf "css/schemes/%s.css" (.Site.Params.colorScheme | default "congo")) }}
@ -35,7 +35,7 @@
<link
type="text/css"
rel="stylesheet"
href="{{ $schemeStyles.Permalink }}"
href="{{ $schemeStyles.RelPermalink }}"
integrity="{{ $schemeStyles.Data.Integrity }}"
/>
{{ $mainCSS := resources.Get "css/compiled/main.css" }}
@ -43,7 +43,7 @@
<link
type="text/css"
rel="stylesheet"
href="{{ $mainStyles.Permalink }}"
href="{{ $mainStyles.RelPermalink }}"
integrity="{{ $mainStyles.Data.Integrity }}"
/>
{{ $customCSS := resources.Get "css/custom.css" }}
@ -52,7 +52,7 @@
<link
type="text/css"
rel="stylesheet"
href="{{ $customStyles.Permalink }}"
href="{{ $customStyles.RelPermalink }}"
integrity="{{ $customStyles.Data.Integrity }}"
/>
{{ end }}
@ -60,10 +60,10 @@
{{ if templates.Exists "partials/favicons.html" }}
{{ partialCached "favicons.html" .Site }}
{{ else }}
<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="16x16" href="{{ "favicon-16x16.png" | absURL }}" />
<link rel="manifest" href="{{ "site.webmanifest" | absURL }}" />
<link rel="apple-touch-icon" sizes="180x180" href="{{ "apple-touch-icon.png" | relURL }}" />
<link rel="icon" type="image/png" sizes="32x32" href="{{ "favicon-32x32.png" | relURL }}" />
<link rel="icon" type="image/png" sizes="16x16" href="{{ "favicon-16x16.png" | relURL }}" />
<link rel="manifest" href="{{ "site.webmanifest" | relURL }}" />
{{ end }}
{{/* Site Verification */}}
{{ with .Site.Params.verification.google }}

View File

@ -3,7 +3,7 @@
<a
class="hover:underline hover:underline-primary-500 hover:underline-thickness-bold hover:underline-offset-small"
rel="me"
href="{{ .Site.BaseURL }}"
href="{{ "/" | relURL }}"
>{{ .Site.Title }}</a
>
</div>
@ -13,7 +13,7 @@
<li class="mb-1 text-right sm:mb-0 sm:mr-7 sm:last:mr-0">
<a
class="hover:underline hover:underline-primary-500 hover:underline-thickness-bold hover:underline-offset-small"
href="{{ .URL | absURL }}"
href="{{ .URL }}"
title="{{ .Title }}"
>{{ .Name }}</a
>

View File

@ -5,7 +5,7 @@
>
<header class="flex flex-col items-center mb-3">
{{ with .Site.Author.image }}
<img class="mb-2 rounded-full w-36 h-36" src="{{ . | absURL }}" />
<img class="mb-2 rounded-full w-36 h-36" src="{{ . | relURL }}" />
{{ end }}
<h1 class="text-4xl font-extrabold">
{{ .Site.Author.name | default .Site.Title }}

View File

@ -4,7 +4,7 @@
"@context": "https://schema.org",
"@type": "WebSite",
"name": "{{ .Site.Title | safeJS }}",
"url": "{{ .Site.BaseURL | safeURL }}",
"url": "{{ (site.GetPage "/").Permalink | safeURL }}",
"description": "{{ .Site.Params.description | safeJS }}"
}
</script>

View File

@ -4,7 +4,7 @@
{{- if .Get "link" -}}
<a href="{{ .Get "link" }}"{{ with .Get "target" }} target="{{ . }}"{{ end }}{{ with .Get "rel" }} rel="{{ . }}"{{ end }}>
{{- end -}}
<img src="{{ $image.Permalink }}"
<img src="{{ $image.RelPermalink }}"
{{- if or (.Get "alt") (.Get "caption") }}
alt="{{ with .Get "alt" }}{{ . }}{{ else }}{{ .Get "caption" | markdownify | plainify }}{{ end }}"
{{- end -}}
@ -25,5 +25,3 @@
{{- end }}
</figure>
{{ end }}

View File

@ -6,7 +6,7 @@
"scripts": {
"dev": "NODE_ENV=development ./node_modules/tailwindcss/lib/cli.js -i ./assets/css/main.css -o ./assets/css/compiled/main.css --jit -w",
"build": "NODE_ENV=production ./node_modules/tailwindcss/lib/cli.js -i ./assets/css/main.css -o ./assets/css/compiled/main.css --jit",
"example": "hugo server --source exampleSite --themesDir ../.. --buildDrafts -b http://localhost -p 8008"
"example": "hugo server --source exampleSite --themesDir ../.. --buildDrafts -b http://localhost/congo/ -p 8008"
},
"repository": {
"type": "git",