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

github.com/zwbetz-gh/cupper-hugo-theme.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlucasradaelli <64749873+lucasradaelli@users.noreply.github.com>2020-06-01 21:47:51 +0300
committerGitHub <noreply@github.com>2020-06-01 21:47:51 +0300
commit8984ca9d6aafa730ad1688ba07ec9fce4add1b91 (patch)
tree0a889d98be098b7d43a89da0291ea63d17f32594 /layouts
parent80cd067683bf69c42f6e02995585462dd9e19d95 (diff)
Custom css and localization support (#28)
* Adds i18n support for theme * Adds a way for sites to have custom css. This change adds a param to the theme (called customCss), which allows sites to provide extra css under static/, so that they don't need to copy the theme's css whole file. If no custom css is in the params, this change is NOP.
Diffstat (limited to 'layouts')
-rw-r--r--layouts/partials/disqus.html6
-rw-r--r--layouts/partials/footer.html2
-rw-r--r--layouts/partials/head.html4
-rw-r--r--layouts/partials/nav.html4
-rw-r--r--layouts/partials/toc.html2
-rw-r--r--layouts/post/single.html8
6 files changed, 15 insertions, 11 deletions
diff --git a/layouts/partials/disqus.html b/layouts/partials/disqus.html
index 47e0661..ccf0340 100644
--- a/layouts/partials/disqus.html
+++ b/layouts/partials/disqus.html
@@ -1,11 +1,11 @@
<div id="disqus-container">
{{ with .Site.DisqusShortname }}
- <button id="disqus-button" onclick="showComments()">Show comments</button>
+ <button id="disqus-button" onclick="showComments()">{{ T "discuss_show_comments_button" }}</button>
<div id="disqus-comments">
{{ $isDummyName := eq . "yourdiscussshortname" }}
{{ $isServer := $.Site.IsServer }}
{{ if or $isDummyName $isServer }}
- <p><em>Disqus comments are disabled.</em></p>
+ <p><em>{{ T "discuss_comments_disabled" }}</em></p>
<script type="application/javascript">
function showComments() {
{{ partial "disqus-js-common.js" . | safeJS }}
@@ -21,7 +21,7 @@
}
</script>
{{ end }}
- <noscript>Enable JavaScript to view Disqus comments.</noscript>
+ <noscript>{{ T "discuss_js_disabled" }}</noscript>
</div>
{{ end }}
</div>
diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html
index 9d24b2a..9334920 100644
--- a/layouts/partials/footer.html
+++ b/layouts/partials/footer.html
@@ -1,7 +1,7 @@
<footer role="contentinfo">
<div>
<label for="themer">
- dark theme: <input type="checkbox" id="themer" class="vh">
+ {{ T "dark_theme" }} <input type="checkbox" id="themer" class="vh">
<span aria-hidden="true"></span>
</label>
</div>
diff --git a/layouts/partials/head.html b/layouts/partials/head.html
index 37d4eb6..2f20857 100644
--- a/layouts/partials/head.html
+++ b/layouts/partials/head.html
@@ -26,6 +26,10 @@
{{ $styles := $templateStyles | resources.ExecuteAsTemplate "css/styles.css" . }}
<link rel="stylesheet" type="text/css" href="{{ $styles.Permalink }}">
+ {{ range .Site.Params.customCss -}}
+ <link rel="stylesheet" href="{{ . | absURL }}">
+ {{- end }}
+
<style id="inverter" media="none">
.intro-and-nav, .main-and-footer { filter: invert(100%) }
* { background-color: inherit }
diff --git a/layouts/partials/nav.html b/layouts/partials/nav.html
index 1abadca..ca80808 100644
--- a/layouts/partials/nav.html
+++ b/layouts/partials/nav.html
@@ -1,10 +1,10 @@
<nav id="patterns-nav" class="patterns" role="navigation">
- <h2 class="vh">Main navigation</h2>
+ <h2 class="vh">{{ T "nav_main_navigation" }}</h2>
<button id="menu-button" aria-expanded="false">
<svg viewBox="0 0 50 50" aria-hidden="true" focusable="false">
<use xlink:href="#menu"></use>
</svg>
- Menu
+ {{ T "nav_button_menu" }}
</button>
{{ $current := . }}
<ul id="patterns-list">
diff --git a/layouts/partials/toc.html b/layouts/partials/toc.html
index 86ee3b6..55a2ccb 100644
--- a/layouts/partials/toc.html
+++ b/layouts/partials/toc.html
@@ -1,7 +1,7 @@
{{ $headings := findRE "<h2.*?>(.|\n])+?</h2>" .Content }}
{{ if ge (len $headings) 2 }}
<nav class="toc" aria-labelledby="toc-heading">
- <h2 id="toc-heading">Table of contents</h2>
+ <h2 id="toc-heading">{{ T "table_of_contents" }}</h2>
<ol>
{{ range $headings }}
<li>
diff --git a/layouts/post/single.html b/layouts/post/single.html
index 72b4c22..6ef8e4e 100644
--- a/layouts/post/single.html
+++ b/layouts/post/single.html
@@ -10,19 +10,19 @@
<div class="date">
{{ $dateFormat := $.Site.Params.dateFormat | default "Jan 2, 2006" }}
{{ $publishDate := .PublishDate }}
- <strong aria-hidden="true">Publish date: </strong>{{ $publishDate.Format $dateFormat }}
+ <strong aria-hidden="true">{{ T "publish_date" }} </strong>{{ $publishDate.Format $dateFormat }}
{{ with .Lastmod }}
{{ if gt . $publishDate }}
<br>
- <strong aria-hidden="true">Last updated: </strong>{{ .Format $dateFormat }}
+ <strong aria-hidden="true">{{ T "last_updated" }} </strong>{{ .Format $dateFormat }}
{{ end }}
{{ end }}
</div>
{{ with .Params.tags }}
<div class="tags">
- <strong aria-hidden="true">Tags: </strong>
- <ul aria-label="tags">
+ <strong aria-hidden="true">{{ T "tags" }} </strong>
+ <ul aria-label="{{ T "aria_label_tags" }}">
{{ range . }}
<li>
<svg class="tag-icon" aria-hidden="true" viewBox="0 0 177.16535 177.16535" focusable="false">