Files
George Cushen ef8ed449c7 feat(hugo): replace deprecated APIs for Hugo v0.156+ compatibility
Migrate site.Data → hugo.Data (42 occurrences), site.IsMultiLingual →
hugo.IsMultilingual, and site.AllPages → hugo.Sites nested range.
Simplify Netlify redirects template to use pre-processed aliases
instead of relLangURL per gohugoio/hugo#14408.
2026-03-27 03:25:42 +00:00

23 lines
1.1 KiB
HTML

{{ if ne .Params.share false }}
<section class="flex flex-row flex-wrap justify-center pt-4 text-xl">
{{ range where hugo.Data.page_sharer.links "enable" true }}
{{/* mailto URIs require percent-encoding (%20 for spaces) per RFC 6068, not form-encoding (+ for spaces). */}}
{{/* Use urls.PathEscape for mailto; urlquery for other schemes (https, etc.). */}}
{{ $is_mailto := eq (urls.Parse .url).Scheme "mailto" }}
{{ $link := replace .url "{url}" (cond $is_mailto (urls.PathEscape $.Permalink) (urlquery $.Permalink)) }}
{{ $link = replace $link "{title}" (cond $is_mailto (urls.PathEscape $.Title) (urlquery $.Title)) }}
<a
target="_blank" rel="noopener"
class="m-1 rounded-md bg-neutral-300 p-1.5 text-neutral-700 hover:bg-primary-500 hover:text-neutral-300 dark:bg-neutral-700 dark:text-neutral-300 dark:hover:bg-primary-400 dark:hover:text-neutral-800"
href="{{$link|safeURL}}"
title="{{ .title }}"
aria-label="{{ .title }}"
id="share-link-{{.id}}"
>
{{ partial "functions/get_icon" (dict "name" .icon "attributes" "style=\"height: 1em;\"") }}
</a>
{{ end }}
</section>
{{ end }}