show languages for posts #92

This commit is contained in:
Dmitry Kolosov 2021-07-08 23:32:45 +03:00
parent 866556ffb3
commit de6decde38
5 changed files with 54 additions and 0 deletions

View File

@ -321,11 +321,19 @@ article:not(:last-of-type) {
padding-bottom: 2em; padding-bottom: 2em;
} }
article header {
margin-top: 1em;
line-height: 1.1em;
margin-bottom: 0.5em;
}
article header h1 { article header h1 {
font-size: 1.35em; font-size: 1.35em;
line-height: 1.1em; line-height: 1.1em;
margin-bottom: 0.5em; margin-bottom: 0.5em;
font-weight: 600; font-weight: 600;
display: inline;
} }
article header h1 a { article header h1 a {
@ -428,6 +436,32 @@ article figcaption {
display: block; display: block;
} }
.post-translations {
margin-left: 0.5em;
list-style: none;
padding: 0;
display: inline;
font-size: 14px;
}
.post-translations > li {
display: inline;
}
.post-translations > li:not(:last-child)::after {
content: "|";
display: inline-block;
}
.post-translations > li a {
color: var(--link-color);
}
.post-translations > li a:hover,
.post-translations > li a:focus {
color: var(--link-state-color);
}
/* Other pages */ /* Other pages */
.terms { .terms {
list-style-type: none; list-style-type: none;

View File

@ -10,6 +10,7 @@
<div class="post-short-list h-entry"> <div class="post-short-list h-entry">
<header class="post-header"> <header class="post-header">
<h2 class="p-name post-title{{ if .Params.favorite }} favorite{{end}}{{ if .Params.draft }} draft{{end}}"><a class="u-url" href="{{ .RelPermalink }}">{{ trim .Title " " }}</a></h2> <h2 class="p-name post-title{{ if .Params.favorite }} favorite{{end}}{{ if .Params.draft }} draft{{end}}"><a class="u-url" href="{{ .RelPermalink }}">{{ trim .Title " " }}</a></h2>
{{ partial "post-language-switcher.html" . }}
</header> </header>
{{ partial "postInfo.html" . }} {{ partial "postInfo.html" . }}
</div> </div>

View File

@ -10,6 +10,8 @@
<article class="post h-entry"> <article class="post h-entry">
<header class="post-header"> <header class="post-header">
<h1 class="p-name post-title{{ if .Params.favorite }} favorite{{end}}{{ if .Params.draft }} draft{{end}}">{{ trim .Title " " }}</h1> <h1 class="p-name post-title{{ if .Params.favorite }} favorite{{end}}{{ if .Params.draft }} draft{{end}}">{{ trim .Title " " }}</h1>
{{ partial "post-language-switcher.html" . }}
</header> </header>
<div class="content e-content"> <div class="content e-content">
{{ .Content }} {{ .Content }}

View File

@ -0,0 +1,16 @@
{{ if .IsTranslated }}
{{ $pageLang := .Page.Lang}}
<ul class="post-translations">
{{ range .AllTranslations }}
{{ if eq .Lang $pageLang }}
<li>
{{ upper .Lang }}
</li>
{{ else }}
<li>
<a href="{{ .Permalink }}">{{ upper .Lang }}</a>
</li>
{{ end }}
{{ end }}
</ul>
{{ end }}

View File

@ -1,6 +1,7 @@
<article class="post-list h-feed"> <article class="post-list h-feed">
<header class="post-header"> <header class="post-header">
<h1 class="p-name post-title{{ if .Params.favorite }} favorite{{end}}{{ if .Params.draft }} draft{{end}}"><a class="u-url" href="{{ .RelPermalink }}">{{ trim .Title " " }}</a></h1> <h1 class="p-name post-title{{ if .Params.favorite }} favorite{{end}}{{ if .Params.draft }} draft{{end}}"><a class="u-url" href="{{ .RelPermalink }}">{{ trim .Title " " }}</a></h1>
{{ partial "post-language-switcher.html" . }}
</header> </header>
{{ if not .Site.Params.disableSummary }} {{ if not .Site.Params.disableSummary }}