From c89a2deb1d8ad35162f528dcf2fbc6a012f1d9b8 Mon Sep 17 00:00:00 2001 From: Emmanuel Gautier Date: Sat, 14 Sep 2024 17:14:39 +0200 Subject: [PATCH] feat: change links rel and target blank --- .github/workflows/hugo.yml | 2 +- layouts/_default/_markup/render-link.html | 29 +++++++++++++++++++++++ layouts/_default/baseof.html | 2 +- layouts/index.html | 8 ++++++- 4 files changed, 38 insertions(+), 3 deletions(-) create mode 100644 layouts/_default/_markup/render-link.html diff --git a/.github/workflows/hugo.yml b/.github/workflows/hugo.yml index b713400..39d4761 100644 --- a/.github/workflows/hugo.yml +++ b/.github/workflows/hugo.yml @@ -31,7 +31,7 @@ jobs: build: runs-on: ubuntu-latest env: - HUGO_VERSION: 0.108.0 + HUGO_VERSION: 0.123.7 steps: - name: Install Hugo CLI run: | diff --git a/layouts/_default/_markup/render-link.html b/layouts/_default/_markup/render-link.html new file mode 100644 index 0000000..609675c --- /dev/null +++ b/layouts/_default/_markup/render-link.html @@ -0,0 +1,29 @@ +{{- $u := urls.Parse .Destination -}} +{{- $href := $u.String -}} +{{- if strings.HasPrefix $u.String "#" }} + {{- $href = printf "%s#%s" .Page.RelPermalink $u.Fragment }} +{{- else if not $u.IsAbs -}} + {{- with or + ($.Page.GetPage $u.Path) + ($.Page.Resources.Get $u.Path) + (resources.Get $u.Path) + -}} + {{- $href = .RelPermalink -}} + {{- with $u.RawQuery -}} + {{- $href = printf "%s?%s" $href . -}} + {{- end -}} + {{- with $u.Fragment -}} + {{- $href = printf "%s#%s" $href . -}} + {{- end -}} + {{- end -}} +{{- end -}} +{{- $attributes := dict "href" $href "title" .Title -}} +{{ .Text | safeHTML }} +{{- /**/ -}} \ No newline at end of file diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index c02e76f..dbc8d06 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -78,7 +78,7 @@ - Star me on GitHub + Star me on GitHub {{ block "main" . }} diff --git a/layouts/index.html b/layouts/index.html index 082eef1..3193e08 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -2,4 +2,10 @@
{{ readFile "README.md" | markdownify }}
-{{ end }} \ No newline at end of file +{{ end }} + +{{ define "footer" }} + +{{ end }}