From 30f865ef21d6ba2113a41b33657c70d60334400c Mon Sep 17 00:00:00 2001 From: Aditya Telange <21258296+adityatelange@users.noreply.github.com> Date: Sun, 3 May 2026 12:47:39 +0530 Subject: [PATCH] refactor(edit_post): improve edit post URL handling and readability --- layouts/_partials/edit_post.html | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/layouts/_partials/edit_post.html b/layouts/_partials/edit_post.html index d24f5b55..b4bf44f4 100644 --- a/layouts/_partials/edit_post.html +++ b/layouts/_partials/edit_post.html @@ -1,10 +1,20 @@ -{{- if and (or .Params.editPost.URL site.Params.editPost.URL) (not (.Param "editPost.disabled")) -}} -{{- $fileUrlPath := path.Join .File.Path }} +{{- if and (.Param "editPost.URL") (not (.Param "editPost.disabled")) -}} + {{- if or (.Param "author") (.Param "ShowReadingTime") (not .Date.IsZero) .IsTranslated }} + {{- printf " | " | safeHTML -}} + {{- end -}} -{{- if or .Params.author site.Params.author (.Param "ShowReadingTime") (not .Date.IsZero) .IsTranslated }} | {{- end -}} - - - {{- .Params.editPost.Text | default (site.Params.editPost.Text | default (i18n "edit_post" | default "Edit")) -}} - - + {{- $editURL := .Param "editPost.URL" }} + {{- $appendFilePath := .Param "editPost.appendFilePath" | default false }} + {{- $editText := .Param "editPost.Text" | default (i18n "edit_post" ) -}} + + {{- if $appendFilePath -}} + {{- $fileUrlPath := path.Join .File.Path }} + {{- $editURL = printf "%s/%s" $editURL $fileUrlPath -}} + {{- end -}} + + + + {{- $editText -}} + + {{- end }}