Skip to content

Commit

Permalink
Merge pull request #14 from cerberauth/rel-links
Browse files Browse the repository at this point in the history
feat: change links rel and target blank
  • Loading branch information
emmanuelgautier authored Sep 14, 2024
2 parents 7b5bf62 + c89a2de commit 27d580f
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/hugo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
29 changes: 29 additions & 0 deletions layouts/_default/_markup/render-link.html
Original file line number Diff line number Diff line change
@@ -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 -}}
<a
{{- range $k, $v := $attributes -}}
{{- if $v -}}
{{- printf " %s=%q" $k $v | safeHTMLAttr -}}
{{- end -}}
{{- end -}}
{{- if $u.IsAbs }} rel="nofollow noopener" target="_blank"{{- end -}}
>{{ .Text | safeHTML }}</a>
{{- /**/ -}}
2 changes: 1 addition & 1 deletion layouts/_default/baseof.html
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@

<body>
<span id="forkongithub">
<a href="{{ .Site.BaseURL }}">Star me on GitHub</a>
<a href="{{ .Site.BaseURL }}" rel="nofollow">Star me on GitHub</a>
</span>

{{ block "main" . }}
Expand Down
8 changes: 7 additions & 1 deletion layouts/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,10 @@
<main aria-role="main">
{{ readFile "README.md" | markdownify }}
</main>
{{ end }}
{{ end }}

{{ define "footer" }}
<footer aria-role="footer">
<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>
</footer>
{{ end }}

0 comments on commit 27d580f

Please sign in to comment.