Skip to content
This repository has been archived by the owner on Mar 12, 2024. It is now read-only.

Commit

Permalink
Add optional Read more. Close #47
Browse files Browse the repository at this point in the history
  • Loading branch information
Mitrichius committed Aug 12, 2020
1 parent 09f5cf0 commit 3d08f96
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 10 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -66,6 +67,7 @@ params:
dateFormat: "2006-01-02"
paginationSinglePost: true
style: light-without-switcher
readMore: false

markup:
goldmark:
Expand Down
1 change: 1 addition & 0 deletions exampleSite/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ googleAnalytics = ""
dateFormat = "2006-01-02"
paginationSinglePost = true
style = "light-without-switcher"
readMore = false

[menu]

Expand Down
1 change: 1 addition & 0 deletions exampleSiteMultilingual/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ googleAnalytics = ""
dateFormat = "2006-01-02"
paginationSinglePost = true
style = "light-without-switcher"
readMore = false

[languages.en]
languageName = "English"
Expand Down
5 changes: 4 additions & 1 deletion layouts/partials/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -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>
4 changes: 2 additions & 2 deletions layouts/partials/postSummary.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ <h1 class="post-title{{ if .Params.favorite }} favorite{{end}}{{ if .Params.draf
<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>
9 changes: 3 additions & 6 deletions layouts/partials/themeSwitcher.html
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -36,8 +36,6 @@
switchButton.addEventListener('click', switchTheme, false)
})



function detectCurrentScheme() {
if (localStorage.getItem(STORAGE_KEY)) {
return localStorage.getItem(STORAGE_KEY)
Expand All @@ -55,9 +53,8 @@
}

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) {
Expand Down
2 changes: 1 addition & 1 deletion static/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ article figcaption {
}

.read-more {
font-size: 0.85em;
margin: 1em 0;
}

.divider {
Expand Down

0 comments on commit 3d08f96

Please sign in to comment.