Skip to content

Commit

Permalink
translation list separate partial
Browse files Browse the repository at this point in the history
  • Loading branch information
adityatelange committed Feb 6, 2021
1 parent 0844985 commit 7170eda
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 34 deletions.
17 changes: 1 addition & 16 deletions layouts/_default/search.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,7 @@ <h1>{{ .Title }}
{{- end }}
{{- if not (.Param "hideMeta") }}
<div class="post-meta">
{{- if .IsTranslated -}}
<ul class="i18n_list">
{{- i18n "translations" | default "Translations"}}:
{{- range .Translations }}
<li>
<a href="{{ .Permalink }}">
{{- if (and $.Site.Params.displayFullLangName (.Language.LanguageName)) }}
{{- .Language.LanguageName | emojify | humanize -}}
{{- else }}
{{- .Lang | humanize -}}
{{- end -}}
</a>
</li>
{{- end }}
</ul>
{{- end }}
{{- partial "translation_list.html" . -}}
</div>
{{- end}}
</header>
Expand Down
20 changes: 2 additions & 18 deletions layouts/_default/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,24 +31,8 @@ <h1 class="post-title">
{{- end }}
{{- if not (.Param "hideMeta") }}
<div class="post-meta">
{{- partial "post_meta.html" . -}}
{{- if .IsTranslated -}}
{{- if or .Params.author $.Site.Params.author (.Param "ShowReadingTime") (not .Date.IsZero) }}&nbsp;|&nbsp;{{- end -}}
<ul class="i18n_list">
{{- i18n "translations" | default "Translations"}}:
{{- range .Translations }}
<li>
<a href="{{ .Permalink }}">
{{- if (and $.Site.Params.displayFullLangName (.Language.LanguageName)) }}
{{- .Language.LanguageName | emojify | humanize -}}
{{- else }}
{{- .Lang | humanize -}}
{{- end -}}
</a>
</li>
{{- end }}
</ul>
{{- end }}
{{- partial "post_meta.html" . -}}
{{- partial "translation_list.html" . -}}
</div>
{{- end}}
</header>
Expand Down
19 changes: 19 additions & 0 deletions layouts/partials/translation_list.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{{- if .IsTranslated -}}
{{- if (ne .Layout "search")}}
{{- if or .Params.author $.Site.Params.author (.Param "ShowReadingTime") (not .Date.IsZero) }}&nbsp;|&nbsp;{{- end -}}
{{- end }}
<ul class="i18n_list">
{{- i18n "translations" | default "Translations"}}:
{{- range .Translations }}
<li>
<a href="{{ .Permalink }}">
{{- if (and $.Site.Params.displayFullLangName (.Language.LanguageName)) }}
{{- .Language.LanguageName | emojify | humanize -}}
{{- else }}
{{- .Lang | humanize -}}
{{- end -}}
</a>
</li>
{{- end }}
</ul>
{{- end }}

0 comments on commit 7170eda

Please sign in to comment.