Add optional Read more. Close #47

This commit is contained in:
Dmitry Kolosov 2020-08-12 22:25:08 +03:00
parent 09f5cf0373
commit 3d08f96509
7 changed files with 14 additions and 10 deletions

View File

@ -20,6 +20,7 @@ Anubis is a simple minimalist theme for [Hugo blog engine](https://gohugo.io/).
- Robots.txt - Robots.txt
- Favorite posts - Favorite posts
- Pagination on post single page - Pagination on post single page
- Optional "Read more" link
## Installation ## Installation
@ -66,6 +67,7 @@ params:
dateFormat: "2006-01-02" dateFormat: "2006-01-02"
paginationSinglePost: true paginationSinglePost: true
style: light-without-switcher style: light-without-switcher
readMore: false
markup: markup:
goldmark: goldmark:

View File

@ -16,6 +16,7 @@ googleAnalytics = ""
dateFormat = "2006-01-02" dateFormat = "2006-01-02"
paginationSinglePost = true paginationSinglePost = true
style = "light-without-switcher" style = "light-without-switcher"
readMore = false
[menu] [menu]

View File

@ -17,6 +17,7 @@ googleAnalytics = ""
dateFormat = "2006-01-02" dateFormat = "2006-01-02"
paginationSinglePost = true paginationSinglePost = true
style = "light-without-switcher" style = "light-without-switcher"
readMore = false
[languages.en] [languages.en]
languageName = "English" languageName = "English"

View File

@ -4,13 +4,16 @@
{{ partial "languageSelect.html" . }} {{ partial "languageSelect.html" . }}
{{ end }} {{ end }}
<div class="common-footer-bottom"> <div class="common-footer-bottom">
<div class="copyright"> <div class="copyright">
<p>© {{ if isset .Site.Params "author"}}{{ .Site.Params.author }}, {{end}}{{ now.Year }}<br> <p>© {{ if isset .Site.Params "author"}}{{ .Site.Params.author }}, {{end}}{{ now.Year }}<br>
{{ i18n "powered" | humanize }} <a target="_blank" rel="noopener noreferrer" href="https://gohugo.io/">Hugo</a>, {{ i18n "theme" }} <a target="_blank" rel="noopener noreferrer" href="https://github.com/mitrichius/hugo-theme-anubis">Anubis</a>. {{ i18n "powered" | humanize }} <a target="_blank" rel="noopener noreferrer" href="https://gohugo.io/">Hugo</a>, {{ i18n "theme" }} <a target="_blank" rel="noopener noreferrer" href="https://github.com/mitrichius/hugo-theme-anubis">Anubis</a>.
</p> </p>
</div> </div>
{{ partial "themeSwitcher.html" . }}
</div> </div>
{{ partial "themeSwitcher.html" . }}
</footer> </footer>

View File

@ -6,11 +6,11 @@
<div class="content post-summary"> <div class="content post-summary">
{{ .Summary | safeHTML }} {{ .Summary | safeHTML }}
</div> </div>
<!-- {{ if .Truncated }} {{ if and (.Truncated) (.Site.Params.readMore) }}
<div class="read-more"> <div class="read-more">
<a href="{{ .RelPermalink }}">{{ i18n "readMore" | humanize }}</a> <a href="{{ .RelPermalink }}">{{ i18n "readMore" | humanize }}</a>
</div> </div>
{{ end }} --> {{ end }}
{{ partial "postInfo.html" . }} {{ partial "postInfo.html" . }}
</article> </article>

View File

@ -5,7 +5,7 @@
{{ if not (in (slice "light-without-switcher" "dark-without-switcher" "auto-without-switcher") $style) }} {{ if not (in (slice "light-without-switcher" "dark-without-switcher" "auto-without-switcher") $style) }}
<button class="theme-switcher"> <button class="theme-switcher">
Dark theme {{ i18n "darkTheme" | humanize }}
</button> </button>
<script> <script>
@ -36,8 +36,6 @@
switchButton.addEventListener('click', switchTheme, false) switchButton.addEventListener('click', switchTheme, false)
}) })
function detectCurrentScheme() { function detectCurrentScheme() {
if (localStorage.getItem(STORAGE_KEY)) { if (localStorage.getItem(STORAGE_KEY)) {
return localStorage.getItem(STORAGE_KEY) return localStorage.getItem(STORAGE_KEY)
@ -55,9 +53,8 @@
} }
function changeButtonText() function changeButtonText()
{ {
console.log(currentTheme) switchButton.textContent = currentTheme == 'dark' ? {{ i18n "lightTheme" | humanize }} : {{ i18n "darkTheme" | humanize }}
switchButton.textContent = currentTheme == 'dark' ? 'Light theme' : 'Dark theme'
} }
function switchTheme(e) { function switchTheme(e) {

View File

@ -343,7 +343,7 @@ article figcaption {
} }
.read-more { .read-more {
font-size: 0.85em; margin: 1em 0;
} }
.divider { .divider {