Merge pull request #2931 from head1328/feat/button-pageref

feat: support pageRef in button shortcode
This commit is contained in:
Nuno C.
2026-05-13 23:12:34 +01:00
committed by GitHub
2 changed files with 20 additions and 2 deletions
+7 -1
View File
@@ -1,6 +1,12 @@
{{- $href := "" -}}
{{- with .Get "pageRef" -}}
{{- $href = relref $.Page . -}}
{{- else -}}
{{- $href = $.Get "href" -}}
{{- end -}}
<a
class="!rounded-md bg-primary-600 px-4 py-2 !text-neutral !no-underline hover:!bg-primary-500 dark:bg-primary-800 dark:hover:!bg-primary-700"
{{ with .Get "href" }}href="{{ . }}"{{ end }}
{{ with $href }}href="{{ . }}"{{ end }}
{{ with .Get "target" }}target="{{ . }}"{{ end }}
{{ with .Get "rel" }}rel="{{ . }}"{{ end }}
role="button">