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

github.com/ertuil/erblog.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLutong Chen <ertuil98@foxmail.com>2020-05-23 06:45:08 +0300
committerLutong Chen <ertuil98@foxmail.com>2020-05-23 06:45:08 +0300
commit01b7aff25383ecbc7374869a330135d6b9612a4a (patch)
tree2dacc4ff57589b0c5468790115360864d687cee7
parent22b8e566d733582467d1cd75aa713d6cb26e0ac6 (diff)
New Paramaters index_posts_num
-rw-r--r--README.md1
-rw-r--r--exampleSite/config.toml1
-rw-r--r--layouts/index.html3
3 files changed, 4 insertions, 1 deletions
diff --git a/README.md b/README.md
index 71f3162..41e5bee 100644
--- a/README.md
+++ b/README.md
@@ -53,6 +53,7 @@ There are some basic configuration options you may want to use:
| Params.bio | A Biography for your Blog | None |
| Params.logo | Your Blog's Logo | None |
| Params.favicon | The favicon file | /favicon.ico |
+| Params.index_posts_num | The number of posts displayed in Index | 5 |
| Params.badge | The color for badge ('red', 'cyan', 'orange', 'green', 'blue', 'black' and 'gray' are available) | 'red' |
| Params.quote | The color for quota ('red', 'cyan', 'orange', 'green', 'blue', 'black' and 'gray' are available) | 'green' |
diff --git a/exampleSite/config.toml b/exampleSite/config.toml
index 4ab5d34..8c98762 100644
--- a/exampleSite/config.toml
+++ b/exampleSite/config.toml
@@ -11,6 +11,7 @@ footnoteReturnLinkContents = "^"
author = "Steve Francia"
badge = "orange"
quote = "red"
+ index_posts_num = 5
# logo = "//blog.ertuil.top/avater.png"
bio = """
<p> This is BIO. You can write something here. </p>
diff --git a/layouts/index.html b/layouts/index.html
index ef6b77e..581dc7d 100644
--- a/layouts/index.html
+++ b/layouts/index.html
@@ -33,7 +33,8 @@
<div class="layui-col-md8 layui-col-sm8 layui-col-xs12">
<h1> Recent Posts </h1>
{{ with (.Site.GetPage "section" "post") }}
- {{range first 5 .Pages.ByDate.Reverse}}
+ {{$index_posts_num := $.Site.Params.index_posts_num | default 8}}
+ {{range first $index_posts_num .Pages.ByDate.Reverse}}
{{ partial "article" .}}
{{end}}
{{ end }}