mirror of https://github.com/lxndrblz/anatole.git

Xiang Li
21.47.2021 ec0bc45e5d7824b5a04daf7f34c221cc66d8eff9
Added readmore links in index.html (#160)

Closes #159
14 files modified
53 ■■■■■ changed files
README.md 7 ●●●●● patch | view | raw | blame | history
exampleSite/config.toml 3 ●●●●● patch | view | raw | blame | history
i18n/de.toml 3 ●●●●● patch | view | raw | blame | history
i18n/dk.toml 3 ●●●●● patch | view | raw | blame | history
i18n/en.toml 3 ●●●●● patch | view | raw | blame | history
i18n/es.toml 3 ●●●●● patch | view | raw | blame | history
i18n/fa.toml 3 ●●●●● patch | view | raw | blame | history
i18n/fi.toml 3 ●●●●● patch | view | raw | blame | history
i18n/fr.toml 3 ●●●●● patch | view | raw | blame | history
i18n/it.toml 3 ●●●●● patch | view | raw | blame | history
i18n/pt-br.toml 3 ●●●●● patch | view | raw | blame | history
i18n/zh-cn.toml 3 ●●●●● patch | view | raw | blame | history
i18n/zh-tw.toml 3 ●●●●● patch | view | raw | blame | history
layouts/index.html 10 ●●●●● patch | view | raw | blame | history
README.md
@@ -150,6 +150,13 @@
listDateFormat = "Jan 2"
```
### Read-more Links
You can enable read-more links for truncated posts by setting the `readMore = true`. The length of the preview is controlled by Hugo's `summarylength`. Read-more links are disabled by default.
```toml
[params]
  readMore = true
```
### Have a static page as a home page
If you prefer having a static page as your home page rather than a listing of the latest posts, then make sure you leave the `mainSections` parameter blank:
```toml
exampleSite/config.toml
@@ -42,6 +42,9 @@
# singleDateFormat = "Mon, Jan 2, 2006"
# Commento Comments
# CommentoURL = "https://commento.example.com/js/commento.js"
# Read More links for truncated summaries
# readMore = true
[params.simpleAnalytics]
# enable = true
i18n/de.toml
@@ -22,3 +22,6 @@
[send]
other = "Senden"
[read_more]
other = "weiterlesen"
i18n/dk.toml
@@ -22,3 +22,6 @@
[send]
other = "Sende"
[read_more]
other = "Læs mere"
i18n/en.toml
@@ -22,3 +22,6 @@
[send]
other = "Send"
[read_more]
other = "Read more"
i18n/es.toml
@@ -22,3 +22,6 @@
[send]
other = "Enviar"
[read_more]
other = "Leer más"
i18n/fa.toml
@@ -22,3 +22,6 @@
[send]
other = "ارسال"
[read_more]
other = "ادامه خواندن"
i18n/fi.toml
@@ -22,3 +22,6 @@
[send]
other = "Lähetä"
[read_more]
other = "Jatka lukemista"
i18n/fr.toml
@@ -22,3 +22,6 @@
[send]
other = "Envoyer"
[read_more]
other = "continuer la lecture"
i18n/it.toml
@@ -22,3 +22,6 @@
[send]
other = "Spedire"
[read_more]
other = "Continua a leggere"
i18n/pt-br.toml
@@ -22,3 +22,6 @@
[send]
other = "Enviar"
[read_more]
other = "continue lendo"
i18n/zh-cn.toml
@@ -22,3 +22,6 @@
[send]
other = "发送"
[read_more]
other = "继续阅读"
i18n/zh-tw.toml
@@ -22,3 +22,6 @@
[send]
other = "發送"
[read_more]
other = "繼續閱讀"
layouts/index.html
@@ -26,8 +26,16 @@
                </h3>
            </div>
            <div class="post-content">
                <div class="p_part"><p>{{ if .Site.Params.fullPostContent }}{{ .Content }}{{ else }}{{ .Summary }}{{ end }}</p></div>
                <div class="p_part">
                    <p>{{ if .Site.Params.fullPostContent }}{{ .Content }}{{ else }}{{ .Summary }}{{ end }}</p>
                    <!-- add read more -->
                    {{- if and (.Truncated) (.Site.Params.readMore) -}}
                        <a href='{{ .RelPermalink }}' class="read_more">{{ i18n "read_more" }}</a>
                    {{- end -}}
            </div>
            </div>
            <!--  -->
            <div class="post-footer">
                <div class="meta">
                    <div class="info">