mirror of
https://github.com/imfing/hextra.git
synced 2025-06-19 08:13:52 -04:00
chore: adapt theme to new template system (#696)
* Adapted theme's layout to [Hugo v0.146.0](https://gohugo.io/templates/new-templatesystem-overview/) * Bumped minimal Hugo version to v0.146.0
This commit is contained in:
16
layouts/_markup/render-link.html
Normal file
16
layouts/_markup/render-link.html
Normal file
@ -0,0 +1,16 @@
|
||||
{{- $dest := .Destination -}}
|
||||
{{- $url := urls.Parse $dest -}}
|
||||
|
||||
{{- if and $dest (hasPrefix $dest "/") -}}
|
||||
{{- with or (.PageInner.GetPage $url.Path) (.PageInner.Resources.Get $url.Path) (resources.Get $url.Path) -}}
|
||||
{{- $query := cond $url.RawQuery (printf "?%s" $url.RawQuery) "" -}}
|
||||
{{- $fragment := cond $url.Fragment (printf "#%s" $url.Fragment) "" -}}
|
||||
{{- $dest = printf "%s%s%s" .RelPermalink $query $fragment -}}
|
||||
{{- else -}}
|
||||
{{- $dest = (relURL (strings.TrimPrefix "/" $dest)) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- with . -}}
|
||||
<a href="{{ $dest | safeURL }}" {{ with .Title }}title="{{ . }}"{{ end }}{{ if strings.HasPrefix .Destination "http" }}target="_blank" rel="noopener"{{ end }}>{{ .Text | safeHTML }}</a>
|
||||
{{- end -}}
|
Reference in New Issue
Block a user