From 2df115a1954845d22e9fa5f73ad55326f2c2dee0 Mon Sep 17 00:00:00 2001 From: Xin Date: Tue, 2 Apr 2024 21:15:03 +0100 Subject: [PATCH] fix: add missing page context for params access --- layouts/partials/components/edit-url.html | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/layouts/partials/components/edit-url.html b/layouts/partials/components/edit-url.html index 11546de..fe8d138 100644 --- a/layouts/partials/components/edit-url.html +++ b/layouts/partials/components/edit-url.html @@ -1,9 +1,13 @@ -{{- $context := .context -}} {{- $editThisPage := (T "editThisPage") | default "Edit this page"}} + +{{- $context := .context -}} + {{- $linkClass := "mb-4 block text-xs text-gray-500 ltr:text-right rtl:text-left dark:text-gray-400" -}} + {{- if and (site.Params.editURL.enable) (eq site.Params.editURL.location .source) -}} {{- $editURL := site.Params.editURL.base | default "" -}} - {{- with .Params.editURL -}} + + {{- with $context.Params.editURL -}} {{/* if `editURL` is set in the front matter */}} {{- $editURL = . -}} {{- else -}} @@ -15,8 +19,10 @@ {{- $editURL = urls.JoinPath $editURL $sourceDir $path -}} {{- end -}} {{- end -}} + {{- if eq site.Params.editURL.location "toc" -}} {{- $linkClass = "hx-text-xs hx-font-medium hx-text-gray-500 hover:hx-text-gray-900 dark:hx-text-gray-400 dark:hover:hx-text-gray-100 contrast-more:hx-text-gray-800 contrast-more:dark:hx-text-gray-50" -}} {{- end -}} + {{ $editThisPage }} {{- end -}}