From 7954509934435cfb02efad79b53dd6495eb0ce90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maxime=20Soul=C3=A9?= Date: Tue, 23 Jan 2024 11:50:32 +0100 Subject: [PATCH] topbar: edit button supports page editURL param before site one MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Maxime Soulé --- layouts/partials/topbar/button/edit.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/layouts/partials/topbar/button/edit.html b/layouts/partials/topbar/button/edit.html index 8d70d8ad5a8..1b78cca9d01 100644 --- a/layouts/partials/topbar/button/edit.html +++ b/layouts/partials/topbar/button/edit.html @@ -4,12 +4,12 @@ {{- with .page }} {{- $format := partial "get-format.hugo" . }} {{- $outputFormat := partial "output-format.hugo" (dict "page" . "format" $format) }} - {{- $editURL := .Site.Params.editURL | default "" }} - {{- if and (eq $outputFormat "html") $editURL .File }} + {{- if and (eq $outputFormat "html") (or .Site.Params.editURL .Params.editURL) .File }} + {{- $href := or .Params.editURL (printf "%s%s%s" .Site.Params.editURL (strings.TrimLeft "/" (replace .File.Dir "\\" "/")) .File.LogicalName) }} {{- partial "topbar/func/button.html" (dict "page" . "class" "topbar-button-edit" - "href" (printf "%s%s%s" $editURL (strings.TrimLeft "/" (replace .File.Dir "\\" "/")) .File.LogicalName) + "href" $href "icon" "pen" "onwidths" $onwidths "onwidthm" $onwidthm