diff options
author | Lutong Chen <ertuil98@foxmail.com> | 2020-05-23 06:45:08 +0300 |
---|---|---|
committer | Lutong Chen <ertuil98@foxmail.com> | 2020-05-23 06:45:08 +0300 |
commit | 01b7aff25383ecbc7374869a330135d6b9612a4a (patch) | |
tree | 2dacc4ff57589b0c5468790115360864d687cee7 | |
parent | 22b8e566d733582467d1cd75aa713d6cb26e0ac6 (diff) |
New Paramaters index_posts_num
-rw-r--r-- | README.md | 1 | ||||
-rw-r--r-- | exampleSite/config.toml | 1 | ||||
-rw-r--r-- | layouts/index.html | 3 |
3 files changed, 4 insertions, 1 deletions
@@ -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 }} |