From 300efb780cbe42a2c830ae76bce717b66abe10cf Mon Sep 17 00:00:00 2001 From: mark Date: Tue, 4 Jul 2023 09:05:49 +0200 Subject: [PATCH 1/5] Fix link behavior for non-urls --- layouts/shortcodes/timeline.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/layouts/shortcodes/timeline.html b/layouts/shortcodes/timeline.html index d2e2720b..9e3b86e6 100644 --- a/layouts/shortcodes/timeline.html +++ b/layouts/shortcodes/timeline.html @@ -59,7 +59,7 @@ {{ $title }} {{ if $badge }}{{ $badge }}{{ end }} {{ else}} - {{ $title }} + {{ $title }} {{ if $badge }}{{ $badge }}{{ end }} {{ end }} From 0c2f951b814ed2cd64846a76a01e95f951523647 Mon Sep 17 00:00:00 2001 From: mark Date: Tue, 4 Jul 2023 09:06:15 +0200 Subject: [PATCH 2/5] Adjust formatting --- layouts/shortcodes/timeline.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/layouts/shortcodes/timeline.html b/layouts/shortcodes/timeline.html index 9e3b86e6..1c917def 100644 --- a/layouts/shortcodes/timeline.html +++ b/layouts/shortcodes/timeline.html @@ -45,9 +45,9 @@ {{- $badge := .badge -}} {{- $url := .url -}} {{- $date := .date -}} - {{ if and $url (not (hasPrefix $url "http")) }} + {{- if and $url (not (hasPrefix $url "http")) -}} {{ $url = path.Join site.Params.docs.release $url }} - {{ end }} + {{- end -}} {{- $direction := .direction -}}
From 4f92886b21527b39d41bed073bb49faaaad59aeb Mon Sep 17 00:00:00 2001 From: mark Date: Tue, 4 Jul 2023 09:33:59 +0200 Subject: [PATCH 3/5] Fix joining of URL --- layouts/shortcodes/timeline.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/layouts/shortcodes/timeline.html b/layouts/shortcodes/timeline.html index 1c917def..ea0250fd 100644 --- a/layouts/shortcodes/timeline.html +++ b/layouts/shortcodes/timeline.html @@ -46,7 +46,7 @@ {{- $url := .url -}} {{- $date := .date -}} {{- if and $url (not (hasPrefix $url "http")) -}} - {{ $url = path.Join site.Params.docs.release $url }} + {{- $url = partial "partials/utilities/URLJoin.html" (dict "base" site.Params.docs.release "path" $url) }} {{- end -}} {{- $direction := .direction -}} From 3627059227972e021347c0fdc1d6029cf5aa9835 Mon Sep 17 00:00:00 2001 From: mark Date: Tue, 4 Jul 2023 09:34:13 +0200 Subject: [PATCH 4/5] Refactor code to join URL --- layouts/partials/utilities/URLJoin.html | 16 ++++++++++++++++ layouts/shortcodes/release.html | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 layouts/partials/utilities/URLJoin.html diff --git a/layouts/partials/utilities/URLJoin.html b/layouts/partials/utilities/URLJoin.html new file mode 100644 index 00000000..83394a54 --- /dev/null +++ b/layouts/partials/utilities/URLJoin.html @@ -0,0 +1,16 @@ +{{- $base := .base -}} +{{- if not $base }} + {{- errorf "partial [assets/utilities/URLJoin.html] - Expected param 'base'" -}} +{{- end -}} + +{{- $path := .path -}} +{{- if not $path }} + {{- errorf "partial [assets/utilities/URLJoin.html] - Expected param 'path'" -}} +{{- end -}} + +{{- $url := $path -}} +{{- if not (hasPrefix $path "http") -}} + {{- $url = printf "%s/%s" (strings.TrimSuffix "/" $base) $path -}} +{{- end }} + +{{- return $url -}} \ No newline at end of file diff --git a/layouts/shortcodes/release.html b/layouts/shortcodes/release.html index 3389ae34..106a62d7 100644 --- a/layouts/shortcodes/release.html +++ b/layouts/shortcodes/release.html @@ -58,7 +58,7 @@
{{- partial "assets/button.html" (dict "title" $title - "href" (printf "%s/%s" (strings.TrimSuffix "/" site.Params.docs.release) $version) + "href" (partial "partials/utilities/URLJoin.html" (dict "base" site.Params.docs.release "path" $version)) "size" "sm" "color" $color "outline" "true" From b3469d277c8992fd03e95f532d94371399317d15 Mon Sep 17 00:00:00 2001 From: mark Date: Tue, 4 Jul 2023 09:34:41 +0200 Subject: [PATCH 5/5] Bump package release --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 60ec1327..31feb7ce 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@gethinode/hinode", - "version": "0.15.4", + "version": "0.15.5", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@gethinode/hinode", - "version": "0.15.4", + "version": "0.15.5", "license": "MIT", "devDependencies": { "@fortawesome/fontawesome-free": "^6.4.0", diff --git a/package.json b/package.json index 95e9225a..a632814b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@gethinode/hinode", - "version": "0.15.4", + "version": "0.15.5", "description": "Hinode is a clean documentation and blog theme for Hugo, an open-source static site generator", "keywords": [ "hugo",