Add links to translated content
Links to translated content will appear next to the date, both on the index page and on post pages. Also style the translation links on post pages to be like those on the index page, although some more thought about the design is probably in order.
This commit is contained in:
parent
c4cfe47e01
commit
ff657d2db1
@ -3,6 +3,10 @@
|
||||
translation: "January 2, 2006"
|
||||
- id: postedOnDate
|
||||
translation: "Posted on {{ .Count }}"
|
||||
- id: translationsLabel
|
||||
translation: "Other languages: "
|
||||
- id: translationsSeparator
|
||||
translation: ", "
|
||||
- id: readMore
|
||||
translation: "Read More"
|
||||
- id: olderPosts
|
||||
|
@ -3,6 +3,10 @@
|
||||
translation: "2006年1月2日"
|
||||
- id: postedOnDate
|
||||
translation: "{{ .Count }}に投稿"
|
||||
- id: translationsLabel
|
||||
translation: "翻訳:"
|
||||
- id: translationsSeparator
|
||||
translation: "・"
|
||||
- id: readMore
|
||||
translation: "続きを読む"
|
||||
- id: olderPosts
|
||||
|
@ -30,9 +30,7 @@
|
||||
{{ end }}
|
||||
</a>
|
||||
|
||||
<p class="post-meta">
|
||||
{{ default (i18n "dateFormat") .Site.Params.dateformat | .Date.Format | i18n "postedOnDate" }}
|
||||
</p>
|
||||
{{ partial "post_meta.html" . }}
|
||||
<div class="post-entry">
|
||||
{{ if .Truncated }}
|
||||
{{ .Summary }}
|
||||
|
@ -32,7 +32,7 @@
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ if eq .Type "post" }}
|
||||
<span class="post-meta">{{ default (i18n "dateFormat") .Site.Params.dateformat | .Date.Format | i18n "postedOnDate" }}</span>
|
||||
{{ partial "post_meta.html" . }}
|
||||
{{ end }}
|
||||
</div>
|
||||
</div>
|
||||
@ -57,7 +57,7 @@
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ if eq .Type "post" }}
|
||||
<span class="post-meta">{{ default (i18n "dateFormat") .Site.Params.dateformat | .Date.Format | i18n "postedOnDate" }}</span>
|
||||
{{ partial "post_meta.html" . }}
|
||||
{{ end }}
|
||||
</div>
|
||||
</div>
|
||||
|
11
layouts/partials/post_meta.html
Normal file
11
layouts/partials/post_meta.html
Normal file
@ -0,0 +1,11 @@
|
||||
<span class="post-meta">
|
||||
{{ default (i18n "dateFormat") .Site.Params.dateformat | .Date.Format | i18n "postedOnDate" }}
|
||||
{{ if .IsTranslated -}}
|
||||
{{- $sortedTranslations := sort .Translations "Site.Language.Weight" -}}
|
||||
{{- $links := apply $sortedTranslations "partial" "translation_link.html" "." -}}
|
||||
{{- $cleanLinks := apply $links "chomp" "." -}}
|
||||
{{- $linksOutput := delimit $cleanLinks (i18n "translationsSeparator") -}}
|
||||
• {{ i18n "translationsLabel" }}{{ $linksOutput }}
|
||||
{{- end }}
|
||||
</span>
|
||||
|
2
layouts/partials/translation_link.html
Normal file
2
layouts/partials/translation_link.html
Normal file
@ -0,0 +1,2 @@
|
||||
<a href="{{ .Permalink }}" lang="{{ .Lang }}">{{ default .Lang .Site.Language.LanguageName }}</a>
|
||||
|
@ -337,6 +337,11 @@ footer .theme-by {
|
||||
font-style: italic;
|
||||
margin: 0 0 10px;
|
||||
}
|
||||
.post-preview .post-meta a,
|
||||
.post-heading .post-meta a {
|
||||
color: #404040;
|
||||
text-decoration: none;
|
||||
}
|
||||
.post-preview .post-entry {
|
||||
font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
|
||||
}
|
||||
@ -694,4 +699,4 @@ td.gutter {
|
||||
input.gsc-input, .gsc-input-box, .gsc-input-box-hover, .gsc-input-box-focus, .gsc-search-button {
|
||||
box-sizing: content-box;
|
||||
line-height: normal;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user