Merge pull request #18 from ch3nnn/main
feat: support divide post list by year
This commit is contained in:
commit
6cd4ade998
@ -54,6 +54,10 @@ Another thing you can do to customize the index page is show the description of
|
|||||||
|
|
||||||
You can add a table of contents by supplying the `toc: true` param to your post front matter. If you want a border around it you can also set `tocBorder: true`. The toc style behavior is handled by Goldmark and the defaults can be found in the `config.toml` file.
|
You can add a table of contents by supplying the `toc: true` param to your post front matter. If you want a border around it you can also set `tocBorder: true`. The toc style behavior is handled by Goldmark and the defaults can be found in the `config.toml` file.
|
||||||
|
|
||||||
|
### Posts list group by date in descending order.
|
||||||
|
|
||||||
|
just edit `config.toml` and change `params.theme_config.isListGroupByDate` to `true`.
|
||||||
|
|
||||||
### Pro tips
|
### Pro tips
|
||||||
|
|
||||||
#### Dark mode for images
|
#### Dark mode for images
|
||||||
|
@ -33,3 +33,4 @@
|
|||||||
appearance = "auto"
|
appearance = "auto"
|
||||||
back_home_text = ".."
|
back_home_text = ".."
|
||||||
date_format = "2006-01-02"
|
date_format = "2006-01-02"
|
||||||
|
isListGroupByDate = false
|
||||||
|
@ -4,5 +4,19 @@
|
|||||||
<h1>{{ .Title }}</h1>
|
<h1>{{ .Title }}</h1>
|
||||||
|
|
||||||
{{ .Content }}
|
{{ .Content }}
|
||||||
{{ partial "post_list.html" (dict "context" . "section" .Section)}}
|
|
||||||
|
<!-- divide post list by year -->
|
||||||
|
{{ if .Site.Params.theme_config.isListGroupByDate }}
|
||||||
|
{{ range .Pages.GroupByDate "2006 Year" }}
|
||||||
|
<p>{{ .Key }}</p>
|
||||||
|
<ul>
|
||||||
|
{{ range .Pages }}
|
||||||
|
<li><a href="{{ .RelPermalink }}">{{ .Title }}</a></li>
|
||||||
|
{{ end }}
|
||||||
|
</ul>
|
||||||
|
{{ end }}
|
||||||
|
{{ else }}
|
||||||
|
{{ partial "post_list.html" (dict "context" . "section" .Section)}}
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
{{ end }}
|
{{ end }}
|
Loading…
x
Reference in New Issue
Block a user