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

gitlab.com/rmaguiar/hugo-theme-color-your-world.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrmaguiar <rmaguiar@tuta.io>2020-08-10 20:09:16 +0300
committerrmaguiar <rmaguiar@tuta.io>2020-08-10 20:09:16 +0300
commita7a0189564cdf75708e623ce33a95823d1e92d56 (patch)
treeb068dcdcf4a6eebb49f22071bf73f928cb142d7c /layouts
parent2e125316f5cc37b69e3ca8081999c338be6237e1 (diff)
Minor improvement to a11y, caching and minor changes
Diffstat (limited to 'layouts')
-rw-r--r--layouts/_default/baseof.html2
-rw-r--r--layouts/_default/list.html18
-rw-r--r--layouts/_default/search.html2
-rw-r--r--layouts/index.html15
-rw-r--r--layouts/partials/footer-opt.html15
-rw-r--r--layouts/partials/footer.html24
-rw-r--r--layouts/partials/post-list.html22
-rw-r--r--layouts/partials/tag-list.html6
8 files changed, 51 insertions, 53 deletions
diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html
index f0f1679..08d1f35 100644
--- a/layouts/_default/baseof.html
+++ b/layouts/_default/baseof.html
@@ -15,7 +15,7 @@
<body>
<header>
- {{ partial "header" . }}
+ {{ partialCached "header" . }}
</header>
<div class="filler">
diff --git a/layouts/_default/list.html b/layouts/_default/list.html
index d0aab9c..07d2c6a 100644
--- a/layouts/_default/list.html
+++ b/layouts/_default/list.html
@@ -9,7 +9,7 @@
<!-- Display search form before listing posts -->
{{ if and .Site.Params.Search.enable (gt (len $searchPages) 0) (eq .Kind "section") }}
- {{ partial "search-form" . }}
+ {{ partialCached "search-form" . }}
{{ end }}
<h1>{{ $currentTitle }}</h1>
@@ -22,25 +22,13 @@
{{ end }}
{{ else }}
- {{ $paginator := .Paginate (where .Site.RegularPages "Type" "in" .Site.Params.mainSections) }}
-
- <ul class="posts">
- {{ range $paginator.Pages }}
- <li>
- <a class="btn" href="{{ .RelPermalink }}">
- <p>{{ .LinkTitle | emojify }}</p>
- {{ if not .Date.IsZero }}<time datetime="{{ .Date | dateFormat "2006-01-02" }}">{{ .Date.Format "2006-01-02" }}</time>{{ end }}
- </a>
- </li>
- {{ end }}
- </ul>
-
+ {{ partial "post-list" . }}
{{ partial "pagination" . }}
{{ partialCached "tag-list" . }}
{{ end }}
-
+
</main>
{{ end }}
diff --git a/layouts/_default/search.html b/layouts/_default/search.html
index d9f0aed..39a10d9 100644
--- a/layouts/_default/search.html
+++ b/layouts/_default/search.html
@@ -14,7 +14,7 @@
<!-- x-js-template -->
</ul>
- <script id=search-result-template type=text/x-js-template><li><a class=btn href='${link}'><p>${title}</p>${date}</a></li></script>
+ <script id=search-result-template type=text/x-js-template><li><a class=btn href='${link}' title='${title}${titleDate}'><p>${title}</p>${spanDate}</a></li></script>
</main>
diff --git a/layouts/index.html b/layouts/index.html
index a85e73e..c4c3a6c 100644
--- a/layouts/index.html
+++ b/layouts/index.html
@@ -3,6 +3,7 @@
{{ $paginator := .Paginate (where .Site.RegularPages "Type" "in" .Site.Params.mainSections) }}
<main class="index">
+
{{ if .Content }}
<article>
<h1>{{ .Title | emojify }}</h1>
@@ -13,21 +14,11 @@
<h1>{{ T "posts" }}</h1>
- <ul class="posts">
- {{ range $paginator.Pages }}
- <li>
- <a class="btn" href="{{ .Permalink }}">
- <p>{{ .LinkTitle | emojify }}</p>
- {{ if not .Date.IsZero }}<time datetime="{{ .Date | dateFormat "2006-01-02" }}">{{ .Date.Format "2006-01-02" }}</time>{{ end }}
- </a>
- </li>
- {{ end }}
- </ul>
-
+ {{ partial "post-list" . }}
{{ partial "pagination" . }}
{{ end }}
-
+
</main>
{{ end }}
diff --git a/layouts/partials/footer-opt.html b/layouts/partials/footer-opt.html
new file mode 100644
index 0000000..654e7ea
--- /dev/null
+++ b/layouts/partials/footer-opt.html
@@ -0,0 +1,15 @@
+<!-- Get default accent colors -->
+{{ $darkAccent := .Site.Params.Style.darkAccent | default .Site.Data.default.style.darkAccent }}
+{{ $lightAccent := .Site.Params.Style.lightAccent | default .Site.Data.default.style.lightAccent }}
+
+
+<section class="req-js">
+ <button class="outline-dashed" title="{{ T "changeMode" }}"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><use xlink:href="#adjust"/></svg></button><input class="outline-dashed" type="color" list="presets" value="{{ if .Site.Params.Style.isDark }}{{ $darkAccent }}{{ else }}{{ $lightAccent }}{{ end }}" title="{{ T "changeAccent" }}" aria-label="{{ T "changeAccent" }}"><datalist id="presets"><option value="{{ $lightAccent }}"><option value="{{ $darkAccent }}">{{- range .Site.Params.style.presets -}}<option value="{{ . }}">{{ end }}</datalist>
+</section>
+
+<!-- noscript notice -->
+{{ if .Site.Params.hasNoscriptNotice }}
+ <noscript>
+ <p class="noscript">{{ T "noscript" }}</p>
+ </noscript>
+{{ end }}
diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html
index 84c2bc3..9ea8cee 100644
--- a/layouts/partials/footer.html
+++ b/layouts/partials/footer.html
@@ -1,7 +1,3 @@
-<!-- Get default accent colors -->
-{{ $darkAccent := .Site.Params.Style.darkAccent | default .Site.Data.default.style.darkAccent }}
-{{ $lightAccent := .Site.Params.Style.lightAccent | default .Site.Data.default.style.lightAccent }}
-
<!-- Custom or default copyright -->
{{ if or (templates.Exists "partials/custom/copyright") (templates.Exists "partials/custom/copyright.html") }}
{{ partial "custom/copyright" . }}
@@ -16,26 +12,16 @@
{{ if gt (len .Translations) 0 }}
- {{ $processedKeys := slice }}
+ {{ $processedLangs := slice }}
{{ range .Translations }}
- {{ $currentKey := printf "<a rel=\"alternate\" hreflang=\"%s\" href=\"%s\">%s</a>" .Language.Lang .RelPermalink .Language.LanguageName }}
- {{ $processedKeys = $processedKeys | append $currentKey }}
+ {{ $currentLang := printf "<a rel=\"alternate\" hreflang=\"%s\" href=\"%s\">%s</a>" .Language.Lang .RelPermalink .Language.LanguageName }}
+ {{ $processedLangs = $processedLangs | append $currentLang }}
{{ end }}
- <p>{{ T "alsoAvailable" }}: {{ delimit $processedKeys ", " (T "and") }}.</p>
+ <p>{{ T "alsoAvailable" }}: {{ delimit $processedLangs ", " (T "and") }}.</p>
{{ end }}
-
<!-- Footer button and color picker -->
-<section class="req-js">
- <button class="outline-dashed" title="{{ T "changeMode" }}"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><use xlink:href="#adjust"/></svg></button><input class="outline-dashed" type="color" list="presets" value="{{ if .Site.Params.Style.isDark }}{{ $darkAccent }}{{ else }}{{ $lightAccent }}{{ end }}" title="{{ T "changeAccent" }}" aria-label="{{ T "changeAccent" }}"><datalist id="presets"><option value="{{ $lightAccent }}"><option value="{{ $darkAccent }}"><!-- Extra colors -->{{- range .Site.Params.style.presets -}}<option value="{{ . }}">{{ end }}</datalist>
-</section>
-
-<!-- noscript notice -->
-{{ if .Site.Params.hasNoscriptNotice }}
- <noscript>
- <p class="noscript">{{ T "noscript" }}</p>
- </noscript>
-{{ end }}
+{{ partialCached "footer-opt" . }}
diff --git a/layouts/partials/post-list.html b/layouts/partials/post-list.html
new file mode 100644
index 0000000..732bc9c
--- /dev/null
+++ b/layouts/partials/post-list.html
@@ -0,0 +1,22 @@
+{{ $paginator := .Paginate (where .Site.RegularPages "Type" "in" .Site.Params.mainSections) }}
+
+<ul class="posts">
+ {{ range $paginator.Pages }}
+
+ {{ $pageDate := "" }}
+
+ {{ if not .Date.IsZero }}
+ {{ $pageDate = .Date.Format "2006-01-02" }}
+ {{ end }}
+
+ <li>
+ <a class="btn" href="{{ .RelPermalink }}" title="{{ .LinkTitle }}{{ with $pageDate }}{{ printf " (%s)" . }}{{ end }}">
+ <p>{{ .LinkTitle | emojify }}</p>
+
+ {{ with $pageDate }}
+ <time datetime="{{ . }}">{{ . }}</time>
+ {{ end }}
+ </a>
+ </li>
+ {{ end }}
+</ul>
diff --git a/layouts/partials/tag-list.html b/layouts/partials/tag-list.html
index f46fb09..4f56257 100644
--- a/layouts/partials/tag-list.html
+++ b/layouts/partials/tag-list.html
@@ -2,9 +2,5 @@
<hr>
<h2>{{ T "tags" }}</h2>
- <ul class="terms">
- {{ range .Site.Taxonomies.tags }}
- <li><a class="btn" href="{{ .Page.RelPermalink }}" title="{{ .Page.LinkTitle }} ({{ .Count }})">{{ .Page.LinkTitle }}<span>{{ .Count }}</span></a></li>
- {{ end }}
- </ul>
+ {{ partialCached "tags" . }}
{{ end }}