Skip to content

Commit 27d580f

Browse files
Merge pull request #14 from cerberauth/rel-links
feat: change links rel and target blank
2 parents 7b5bf62 + c89a2de commit 27d580f

File tree

4 files changed

+38
-3
lines changed

4 files changed

+38
-3
lines changed

.github/workflows/hugo.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
build:
3232
runs-on: ubuntu-latest
3333
env:
34-
HUGO_VERSION: 0.108.0
34+
HUGO_VERSION: 0.123.7
3535
steps:
3636
- name: Install Hugo CLI
3737
run: |
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{{- $u := urls.Parse .Destination -}}
2+
{{- $href := $u.String -}}
3+
{{- if strings.HasPrefix $u.String "#" }}
4+
{{- $href = printf "%s#%s" .Page.RelPermalink $u.Fragment }}
5+
{{- else if not $u.IsAbs -}}
6+
{{- with or
7+
($.Page.GetPage $u.Path)
8+
($.Page.Resources.Get $u.Path)
9+
(resources.Get $u.Path)
10+
-}}
11+
{{- $href = .RelPermalink -}}
12+
{{- with $u.RawQuery -}}
13+
{{- $href = printf "%s?%s" $href . -}}
14+
{{- end -}}
15+
{{- with $u.Fragment -}}
16+
{{- $href = printf "%s#%s" $href . -}}
17+
{{- end -}}
18+
{{- end -}}
19+
{{- end -}}
20+
{{- $attributes := dict "href" $href "title" .Title -}}
21+
<a
22+
{{- range $k, $v := $attributes -}}
23+
{{- if $v -}}
24+
{{- printf " %s=%q" $k $v | safeHTMLAttr -}}
25+
{{- end -}}
26+
{{- end -}}
27+
{{- if $u.IsAbs }} rel="nofollow noopener" target="_blank"{{- end -}}
28+
>{{ .Text | safeHTML }}</a>
29+
{{- /**/ -}}

layouts/_default/baseof.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878

7979
<body>
8080
<span id="forkongithub">
81-
<a href="{{ .Site.BaseURL }}">Star me on GitHub</a>
81+
<a href="{{ .Site.BaseURL }}" rel="nofollow">Star me on GitHub</a>
8282
</span>
8383

8484
{{ block "main" . }}

layouts/index.html

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,10 @@
22
<main aria-role="main">
33
{{ readFile "README.md" | markdownify }}
44
</main>
5-
{{ end }}
5+
{{ end }}
6+
7+
{{ define "footer" }}
8+
<footer aria-role="footer">
9+
<p className="text-sm text-gray-500">Proudly part of <a className="text-primary" target="_blank" href="https://www.cerberauth.com?utm_source=awesome-openidconnect">CerberAuth</a> community.</p>
10+
</footer>
11+
{{ end }}

0 commit comments

Comments
 (0)