i18n .Title in sections and regular pages for hugo 57
- .Site.RegularPages instead of .Data.Pages in layouts/index.html - i18n .Title in layouts/partial/header.html
This commit is contained in:
		
							
								
								
									
										8
									
								
								i18n/ru.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								i18n/ru.yaml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,8 @@
 | 
			
		||||
- id: Tags
 | 
			
		||||
  translation: "Теги"
 | 
			
		||||
- id: Posts
 | 
			
		||||
  translation: "Посты"
 | 
			
		||||
- id: Pages
 | 
			
		||||
  translation: "Страницы"
 | 
			
		||||
- id: Categories
 | 
			
		||||
  translation: "Категории"
 | 
			
		||||
							
								
								
									
										65
									
								
								layouts/index.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										65
									
								
								layouts/index.html
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,65 @@
 | 
			
		||||
{{ define "main" }}
 | 
			
		||||
  <div role="main" class="container">
 | 
			
		||||
    <div class="row">
 | 
			
		||||
      <div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
 | 
			
		||||
        {{ with .Content }}
 | 
			
		||||
          <div class="well">
 | 
			
		||||
            {{.}}
 | 
			
		||||
          </div>
 | 
			
		||||
        {{ end }}
 | 
			
		||||
 | 
			
		||||
        <div class="posts-list">
 | 
			
		||||
          {{ $pag := .Paginate (where .Site.RegularPages "Type" "post") }}
 | 
			
		||||
          {{ range $pag.Pages }}
 | 
			
		||||
            <article class="post-preview">
 | 
			
		||||
              <a href="{{ .Permalink }}">
 | 
			
		||||
                <h2 class="post-title">{{ .Title }}</h2>
 | 
			
		||||
                {{ if .Params.subtitle }}
 | 
			
		||||
                  <h3 class="post-subtitle">
 | 
			
		||||
                  {{ .Params.subtitle }}
 | 
			
		||||
                  </h3>
 | 
			
		||||
                {{ end }}
 | 
			
		||||
                {{ if .Params.image }}
 | 
			
		||||
                <img src="{{ .Params.image }}" alt="{{ .Title }}" class="img-title" />
 | 
			
		||||
                {{ end }}
 | 
			
		||||
              </a>
 | 
			
		||||
 | 
			
		||||
              {{ partial "post_meta.html" . }}
 | 
			
		||||
              <div class="post-entry">
 | 
			
		||||
                {{ if .Truncated }}
 | 
			
		||||
                  {{ if .Params.summary }}{{ .Params.summary }}{{ else }}{{ .Summary }}{{ end }}
 | 
			
		||||
                  <a href="{{ .Permalink }}" class="post-read-more">[{{ i18n "readMore" }}]</a>
 | 
			
		||||
                {{ else }}
 | 
			
		||||
                  {{ .Content }}
 | 
			
		||||
                {{ end }}
 | 
			
		||||
              </div>
 | 
			
		||||
 | 
			
		||||
              {{ if .Params.tags }}
 | 
			
		||||
                <div class="blog-tags">
 | 
			
		||||
                  {{ range .Params.tags }}
 | 
			
		||||
                    <a href="{{ $.Site.LanguagePrefix | absURL }}/tags/{{ . | urlize }}/">{{ . }}</a> 
 | 
			
		||||
                  {{ end }}
 | 
			
		||||
                </div>
 | 
			
		||||
              {{ end }}
 | 
			
		||||
            </article>
 | 
			
		||||
          {{ end }}
 | 
			
		||||
        </div>
 | 
			
		||||
 | 
			
		||||
        {{ if or (.Paginator.HasPrev) (.Paginator.HasNext) }}
 | 
			
		||||
          <ul class="pager main-pager">
 | 
			
		||||
            {{ if .Paginator.HasPrev }}
 | 
			
		||||
              <li class="previous">
 | 
			
		||||
                <a href="{{ .Permalink }}page/{{ .Paginator.Prev.PageNumber }}/">← {{ i18n "newerPosts" }}</a>
 | 
			
		||||
              </li>
 | 
			
		||||
            {{ end }}
 | 
			
		||||
            {{ if .Paginator.HasNext }}
 | 
			
		||||
              <li class="next">
 | 
			
		||||
                <a href="{{ .Permalink }}page/{{ .Paginator.Next.PageNumber }}/">{{ i18n "olderPosts" }} →</a>
 | 
			
		||||
              </li>
 | 
			
		||||
            {{ end }}
 | 
			
		||||
          </ul>
 | 
			
		||||
        {{ end }}
 | 
			
		||||
      </div>
 | 
			
		||||
    </div>
 | 
			
		||||
  </div>
 | 
			
		||||
{{ end }}
 | 
			
		||||
							
								
								
									
										87
									
								
								layouts/partials/header.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										87
									
								
								layouts/partials/header.html
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,87 @@
 | 
			
		||||
{{- partial "load-photoswipe-theme.html" . }}
 | 
			
		||||
 | 
			
		||||
{{ if .IsHome }}
 | 
			
		||||
  {{ if .Site.Params.homeTitle }}{{ $.Scratch.Set "title" .Site.Params.homeTitle }}{{ else }}{{ $.Scratch.Set "title" .Site.Title }}{{ end }}
 | 
			
		||||
  {{ if .Site.Params.subtitle }}{{ $.Scratch.Set "subtitle" .Site.Params.subtitle }}{{ end }}
 | 
			
		||||
  {{ if .Site.Params.bigimg }}{{ $.Scratch.Set "bigimg" .Site.Params.bigimg }}{{ end }}
 | 
			
		||||
{{ else }}
 | 
			
		||||
  {{ if (i18n .Title) }}{{ $.Scratch.Set "title" (i18n .Title) }}{{ else }}{{ $.Scratch.Set "title" .Title }}{{ end }}
 | 
			
		||||
  {{ if .Params.subtitle }}{{ $.Scratch.Set "subtitle" .Params.subtitle }}{{ end }}
 | 
			
		||||
  {{ if .Params.bigimg }}{{ $.Scratch.Set "bigimg" .Params.bigimg }}{{ end }}
 | 
			
		||||
{{ end }}
 | 
			
		||||
{{ $bigimg := $.Scratch.Get "bigimg" }}
 | 
			
		||||
{{ $title := $.Scratch.Get "title" }}
 | 
			
		||||
{{ $subtitle := $.Scratch.Get "subtitle" }}
 | 
			
		||||
 | 
			
		||||
{{ if or $bigimg $title }}
 | 
			
		||||
  {{ if $bigimg }}
 | 
			
		||||
    <div id="header-big-imgs" data-num-img={{len $bigimg}} 
 | 
			
		||||
      {{range $i, $img := $bigimg}}
 | 
			
		||||
         {{ if (fileExists $img.src)}} 
 | 
			
		||||
          data-img-src-{{add $i 1}}="{{$img.src | absURL }}" 
 | 
			
		||||
         {{else}}
 | 
			
		||||
          data-img-src-{{add $i 1}}="{{$img.src}}" 
 | 
			
		||||
         {{end}}
 | 
			
		||||
         {{ if $img.desc}}data-img-desc-{{add $i 1}}="{{$img.desc}}"{{end}}
 | 
			
		||||
      {{end}}></div>
 | 
			
		||||
  {{ end }}
 | 
			
		||||
 | 
			
		||||
  <header class="header-section {{ if $bigimg }}has-img{{ end }}">
 | 
			
		||||
    {{ if $bigimg }}
 | 
			
		||||
      <div class="intro-header big-img">
 | 
			
		||||
        {{ $subtitle := $.Scratch.Get "subtitle" }}
 | 
			
		||||
        <div class="container">
 | 
			
		||||
          <div class="row">
 | 
			
		||||
            <div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
 | 
			
		||||
              <div class="{{ .Type }}-heading">
 | 
			
		||||
                <h1>{{ with $.Scratch.Get "title" }}{{.}}{{ else }}<br/>{{ end }}</h1>
 | 
			
		||||
                  {{ if $subtitle }}
 | 
			
		||||
                    {{ if eq .Type "page" }}
 | 
			
		||||
                      <hr class="small">
 | 
			
		||||
                      <span class="{{ .Type }}-subheading">{{ $subtitle }}</span>
 | 
			
		||||
                    {{ else }}
 | 
			
		||||
                      <h2 class="{{ .Type }}-subheading">{{ $subtitle }}</h2>
 | 
			
		||||
                    {{ end }}
 | 
			
		||||
                  {{ end }}
 | 
			
		||||
                  {{ if eq .Type "post" }}
 | 
			
		||||
                    {{ partial "post_meta.html" . }}
 | 
			
		||||
                  {{ end }}
 | 
			
		||||
              </div>
 | 
			
		||||
            </div>
 | 
			
		||||
          </div>
 | 
			
		||||
        </div>
 | 
			
		||||
        <span class="img-desc" style="display: inline;"></span>
 | 
			
		||||
      </div>
 | 
			
		||||
    {{end}}
 | 
			
		||||
    <div class="intro-header no-img">
 | 
			
		||||
      <div class="container">
 | 
			
		||||
        <div class="row">
 | 
			
		||||
          <div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
 | 
			
		||||
            <div class="{{ .Type }}-heading">
 | 
			
		||||
              {{ if eq .Type "list" }}
 | 
			
		||||
                <h1>{{ if .Data.Singular }}#{{ end }}{{ .Title }}</h1>
 | 
			
		||||
              {{ else }}
 | 
			
		||||
                <h1>{{ with $title }}{{.}}{{ else }}<br/>{{ end }}</h1>
 | 
			
		||||
              {{ end }}
 | 
			
		||||
              {{ if ne .Type "post" }}
 | 
			
		||||
                <hr class="small">
 | 
			
		||||
              {{ end }}
 | 
			
		||||
              {{ if $subtitle }}
 | 
			
		||||
                {{ if eq .Type "page" }}
 | 
			
		||||
                  <span class="{{ .Type }}-subheading">{{ $subtitle }}</span>
 | 
			
		||||
                {{ else }}
 | 
			
		||||
                  <h2 class="{{ .Type }}-subheading">{{ $subtitle }}</h2>
 | 
			
		||||
                {{ end }}
 | 
			
		||||
              {{ end }}
 | 
			
		||||
              {{ if eq .Type "post" }}
 | 
			
		||||
                {{ partial "post_meta.html" . }}
 | 
			
		||||
              {{ end }}
 | 
			
		||||
            </div>
 | 
			
		||||
          </div>
 | 
			
		||||
        </div>
 | 
			
		||||
      </div>
 | 
			
		||||
    </div>
 | 
			
		||||
  </header>
 | 
			
		||||
{{ else }}
 | 
			
		||||
  <div class="intro-header"></div>
 | 
			
		||||
{{ end }}
 | 
			
		||||
		Reference in New Issue
	
	Block a user