Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/geschke/hugo-tikva.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRalf Geschke <ralf@kuerbis.org>2018-11-16 04:00:45 +0300
committerRalf Geschke <ralf@kuerbis.org>2018-11-16 04:00:45 +0300
commit316cfe7863b97e6350d7c6b21e8ecbb18b189295 (patch)
tree39cbec9de4d0ee008a37c8d14e65403d1983aa95 /layouts
parentb9f171b6fb694af225a87691965400a2021e07ae (diff)
Add some translations with i18n feature, README improvements, summary partial for list list view, minor fixes
Diffstat (limited to 'layouts')
-rw-r--r--layouts/_default/baseof.html2
-rw-r--r--layouts/_default/content.html11
-rw-r--r--layouts/_default/list.html15
-rw-r--r--layouts/_default/single.html18
-rw-r--r--layouts/_default/summary.html22
-rw-r--r--layouts/index.html25
-rw-r--r--layouts/partials/head.html1
-rw-r--r--layouts/partials/javascript_footer.html3
-rw-r--r--layouts/partials/javascript_header.html3
-rw-r--r--layouts/partials/paginator.html45
10 files changed, 119 insertions, 26 deletions
diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html
index c0cccf5..ebf6823 100644
--- a/layouts/_default/baseof.html
+++ b/layouts/_default/baseof.html
@@ -44,6 +44,6 @@
{{ partial "analytics/yandexmetrica.html" . }}
{{- end -}}
{{- partial "bottom.html" . -}}
-
+{{- partial "javascript_footer.html" . }}
</body>
</html> \ No newline at end of file
diff --git a/layouts/_default/content.html b/layouts/_default/content.html
new file mode 100644
index 0000000..ca607a2
--- /dev/null
+++ b/layouts/_default/content.html
@@ -0,0 +1,11 @@
+<article class="blog-post">
+ <header>
+ <h2 class="blog-post-title">
+ <a class="text-dark" href="{{ .RelPermalink }}">{{ .Title | markdownify }}</a>
+ </h2>
+ {{ partial "post-date" . }}
+ {{ partial "post-tags" . }}
+ {{ partial "post-categories" . }}
+ </header>
+ {{ .Content }}
+</article>
diff --git a/layouts/_default/list.html b/layouts/_default/list.html
index d70b1fb..37c907b 100644
--- a/layouts/_default/list.html
+++ b/layouts/_default/list.html
@@ -8,13 +8,14 @@
<!-- "{{.Content}}" pulls from the markdown content of the corresponding _index.md -->
{{.Content}}
</article>
- <ul>
+
<!-- Ranges through content/post/*.md -->
- {{ range .Pages }}
- <li>
- <a href="{{.Permalink}}">{{.Date.Format "2006-01-02"}} | {{.Title}}</a>
- </li>
+ {{ range .Paginator.Pages }}
+
+ {{ .Render "summary"}}
{{ end }}
- </ul>
+
+
+ {{ template "_internal/pagination.html" . }}
</main>
-{{ end }} \ No newline at end of file
+{{ end }}
diff --git a/layouts/_default/single.html b/layouts/_default/single.html
index 0580b5d..ef1ef63 100644
--- a/layouts/_default/single.html
+++ b/layouts/_default/single.html
@@ -1,9 +1,15 @@
-
-{{ define "title" }}
- <!-- This will override the default value set in baseof.html; i.e., "{{.Site.Title}}" in the original example-->
- {{ .Title }} &ndash; {{ .Site.Title }}
-{{ end }}
{{ define "main" }}
- <h1>{{ .Title }}</h1>
+
+{{ $dateFormat := default "Mon Jan 2, 2006" .Site.Params.DateFormat }}
+{{ $author := .Params.author | default .Site.Params.author }}
+
+
+<h1>{{ .Title }}</h1>
+{{ if not .Params.HideMeta }}
+ <div class="post-meta">{{ if .Site.Params.ShowDate }}<span class="byline-icon fa fa-clock-o" aria-hidden="true"></span> <span class="screen-reader-text">{{ i18n "date" }}: </span><time datetime="{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}">{{ .Date.Format $dateFormat }}</time> - {{ end }}{{ if $author }}
+ <span class="byline-icon fa fa-user" aria-hidden="true"></span><span class="screen-reader-text">{{ i18n "author" }}: </span> {{ $author }} - {{ end }}
+ {{ .FuzzyWordCount }} {{ i18n "words" }} </div>
+{{ end }}
+
{{ .Content }}
{{ end }} \ No newline at end of file
diff --git a/layouts/_default/summary.html b/layouts/_default/summary.html
new file mode 100644
index 0000000..6a75cb0
--- /dev/null
+++ b/layouts/_default/summary.html
@@ -0,0 +1,22 @@
+{{ $dateFormat := default "Mon Jan 2, 2006" .Site.Params.DateFormat }}
+{{ $author := .Params.author | default .Site.Params.author }}
+
+<article class="mb-5 post">
+ <header>
+
+ <h2><a href='{{ .Permalink }}'> {{ .Title }}</a> </h2>
+
+ <div class="post-meta">{{ if .Site.Params.ShowDate }}<span class="byline-icon fa fa-clock-o" aria-hidden="true"></span> <span class="screen-reader-text">{{ i18n "date" }}: </span><time datetime="{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}">{{ .Date.Format $dateFormat }}</time> - {{ end }}{{ if $author }}
+ <span class="byline-icon fa fa-user" aria-hidden="true"></span><span class="screen-reader-text">{{ i18n "author" }}: </span> {{ $author }} - {{ end }}
+ {{ .FuzzyWordCount }} {{ i18n "words" }} </div>
+ </header>
+ {{ .Summary }}
+
+ <footer>
+ {{ if .Truncated }}
+ <a href='{{ .Permalink }}'>
+ <span class="btn btn-outline-primary">{{ i18n "readMore" . }} <span class="screen-reader-text">{{ i18n "readMoreOn" }} {{ .Title }}</span><span class="meta-nav"> ยป</span></span>
+ </a>
+ {{ end }}
+ </footer>
+</article> \ No newline at end of file
diff --git a/layouts/index.html b/layouts/index.html
index e0719b4..1c48b86 100644
--- a/layouts/index.html
+++ b/layouts/index.html
@@ -1,22 +1,23 @@
+
{{ define "main" }}
-<main aria-role="main">
- <header class="homepage-header">
+ <main aria-role="main">
+ <header class="homepage-header">
<h1>{{.Title}}</h1>
{{ with .Params.subtitle }}
<span class="subtitle">{{.}}</span>
{{ end }}
- </header>
- <div class="homepage-content">
+ </header>
+ <div class="homepage-content">
<!-- Note that the content for index.html, as a sort of list page, will pull from content/_index.md -->
{{.Content}}
-
- {{.Site.Params.BootstrapTheme}}
- </div>
- <div>
+ </div>
+ <div>
<!-- Note that .Pages is the same as .Site.RegularPages on the homepage template. -->
- {{ range first 10 .Pages }}
- {{ .Render "summary"}}
+ {{/* Activate this (or copy the template into the site's layout folder) to display a page list
+ {{ range first 5 .Pages }}
+ {{ .Render "summary"}}
{{ end }}
- </div>
-</main>
+ */}}
+ </div>
+ </main>
{{ end }} \ No newline at end of file
diff --git a/layouts/partials/head.html b/layouts/partials/head.html
index 4ce0b04..a83cae4 100644
--- a/layouts/partials/head.html
+++ b/layouts/partials/head.html
@@ -292,4 +292,5 @@ body {
<script src="//oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
{{ "<![endif]-->" | safeHTML }}
+{{- partial "javascript_header.html" . }}
</head> \ No newline at end of file
diff --git a/layouts/partials/javascript_footer.html b/layouts/partials/javascript_footer.html
new file mode 100644
index 0000000..7729fc3
--- /dev/null
+++ b/layouts/partials/javascript_footer.html
@@ -0,0 +1,3 @@
+<!-- To add JavaScript code, place a file "javascript_footer.html" into the folder "layouts/partials/" or your main directory.
+This will overwrite this placeholder file, so you can add a JavaScript snippet.
+-->
diff --git a/layouts/partials/javascript_header.html b/layouts/partials/javascript_header.html
new file mode 100644
index 0000000..785a082
--- /dev/null
+++ b/layouts/partials/javascript_header.html
@@ -0,0 +1,3 @@
+<!-- To add JavaScript code, place a file "javascript_header.html" into the folder "layouts/partials/" or your main directory.
+This will overwrite this placeholder file, so you can add a JavaScript snippet.
+-->
diff --git a/layouts/partials/paginator.html b/layouts/partials/paginator.html
new file mode 100644
index 0000000..f0c736b
--- /dev/null
+++ b/layouts/partials/paginator.html
@@ -0,0 +1,45 @@
+{{ $pag := $.Paginator }}
+{{ if gt $pag.TotalPages 1 }}
+<nav class="blog-pagination">
+ <ul class="pagination justify-content-center">
+ {{ with $pag.First }}
+ <li class="page-item">
+ <a class="page-link" href="{{ .URL }}" aria-label="First"><span aria-hidden="true">&laquo;&laquo;</span></a>
+ </li>
+ {{ end }}
+ <li class="page-item {{ if not $pag.HasPrev }}disabled{{ end }}">
+ <a class="page-link" href="{{ if $pag.HasPrev }}{{ $pag.Prev.URL }}{{ end }}" aria-label="Previous"><span aria-hidden="true">&laquo;</span></a>
+ </li>
+ {{ $.Scratch.Set "__paginator.ellipsed" false }}
+ {{ range $pag.Pagers }}
+ {{ $right := sub .TotalPages .PageNumber }}
+ {{ $showNumber := or (le .PageNumber 3) (eq $right 0) }}
+ {{ $showNumber := or $showNumber (and (gt .PageNumber (sub $pag.PageNumber 2)) (lt .PageNumber (add $pag.PageNumber 2))) }}
+ {{ if $showNumber }}
+ {{ $.Scratch.Set "__paginator.ellipsed" false }}
+ {{ $.Scratch.Set "__paginator.shouldEllipse" false }}
+ {{ else }}
+ {{ $.Scratch.Set "__paginator.shouldEllipse" (not ($.Scratch.Get "__paginator.ellipsed") ) }}
+ {{ $.Scratch.Set "__paginator.ellipsed" true }}
+ {{ end }}
+ {{ if $showNumber }}
+ <li class="page-item {{ if eq . $pag }}active{{ end }}">
+ <a class="page-link" href="{{ .URL }}">{{ .PageNumber }}</a>
+ </li>
+ {{ else if ($.Scratch.Get "__paginator.shouldEllipse") }}
+ <li class="page-item disabled">
+ <span class="page-link" aria-hidden="true">&hellip;</span>
+ </li>
+ {{ end }}
+ {{ end }}
+ <li class="page-item {{ if not $pag.HasNext }}disabled{{ end }}">
+ <a class="page-link" href="{{ if $pag.HasNext }}{{ $pag.Next.URL }}{{ end }}" aria-label="Next"><span aria-hidden="true">&raquo;</span></a>
+ </li>
+ {{ with $pag.Last }}
+ <li class="page-item">
+ <a class="page-link" href="{{ .URL }}" aria-label="Last"><span aria-hidden="true">&raquo;&raquo;</span></a>
+ </li>
+ {{ end }}
+ </ul>
+</nav>
+{{ end }}