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
- Favorite posts
- Pagination on post single page
- Optional "Read more" link
## Installation
@ -66,6 +67,7 @@ params:
dateFormat: "2006-01-02"
paginationSinglePost: true
style: light-without-switcher
readMore: false
markup:
goldmark:

View File

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

View File

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

View File

@ -4,13 +4,16 @@
{{ partial "languageSelect.html" . }}
{{ end }}
<div class="common-footer-bottom">
<div class="copyright">
<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>.
</p>
</div>
{{ partial "themeSwitcher.html" . }}
</div>
{{ partial "themeSwitcher.html" . }}
</footer>

View File

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

View File

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

View File

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