Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to show link in meta data for editing posts #278

Merged
merged 8 commits into from
Mar 23, 2021
3 changes: 3 additions & 0 deletions i18n/de.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,6 @@

- id: translations
translation: "Übersetzungen"

- id: edit_post
translation: "Bearbeiten"
1 change: 1 addition & 0 deletions layouts/_default/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ <h1 class="post-title">
{{- if not (.Param "hideMeta") }}
<div class="post-meta">
{{- partial "post_meta.html" . -}}
{{- partial "edit_post.html" . -}}
{{- partial "translation_list.html" . -}}
</div>
{{- end}}
Expand Down
4 changes: 4 additions & 0 deletions layouts/partials/edit_post.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{{- if (.Param "editPost.URL") -}}
{{- if or .Params.author $.Site.Params.author (.Param "ShowReadingTime") (not .Date.IsZero) }}|&nbsp;{{- end -}}
<a href="{{ .Param "editPost.URL" }}/{{ .File.Path }}">{{ .Param "editPost.Text" | default (i18n "edit_post" | default "Edit") }}</a>
{{- end }}
2 changes: 1 addition & 1 deletion layouts/partials/translation_list.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{{- if .IsTranslated -}}
{{- if (ne .Layout "search")}}
{{- if or .Params.author $.Site.Params.author (.Param "ShowReadingTime") (not .Date.IsZero) }}&nbsp;|&nbsp;{{- end -}}
{{- if or .Params.author $.Site.Params.author (.Param "ShowReadingTime") (not .Date.IsZero) (.Param "editPost.URL") }}&nbsp;|&nbsp;{{- end -}}
{{- end }}
<ul class="i18n_list">
{{- i18n "translations" | default "Translations"}}:
Expand Down