hugo-theme-relearn/layouts/partials/topbar/button/edit.html
Maxime Soulé 7954509934
topbar: edit button supports page editURL param before site one
Signed-off-by: Maxime Soulé <btik-git@scoubidou.com>
2024-01-23 11:50:32 +01:00

20 lines
No EOL
861 B
HTML

{{- $onwidths := cond (isset . "onwidths") .onwidths "area-more" }}
{{- $onwidthm := cond (isset . "onwidthm") .onwidthm "show" }}
{{- $onwidthl := cond (isset . "onwidthl") .onwidthl "show" }}
{{- with .page }}
{{- $format := partial "get-format.hugo" . }}
{{- $outputFormat := partial "output-format.hugo" (dict "page" . "format" $format) }}
{{- 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" $href
"icon" "pen"
"onwidths" $onwidths
"onwidthm" $onwidthm
"onwidthl" $onwidthl
"hint" (printf "%s (CTRL+ALT+w)" (T "Edit-this-page"))
)}}
{{- end }}
{{- end }}