mirror of
https://github.com/thomasjsn/hugo-theme-hello-friend.git
synced 2024-11-14 04:15:07 +01:00
Add contentTypeName to config
This commit is contained in:
parent
27a013b809
commit
b0dfb769d1
@ -65,6 +65,8 @@ paginate = 5
|
|||||||
|
|
||||||
[params]
|
[params]
|
||||||
subtitle = "A simple theme for Hugo"
|
subtitle = "A simple theme for Hugo"
|
||||||
|
# dir name for your list content
|
||||||
|
contentTypeName = "posts"
|
||||||
# "light" or "dark"
|
# "light" or "dark"
|
||||||
defaultTheme = "dark"
|
defaultTheme = "dark"
|
||||||
|
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
{{ define "main" }}
|
{{ define "main" }}
|
||||||
<div class="posts">
|
<div class="posts">
|
||||||
{{ $paginator := .Paginate (where .Data.Pages "Type" "post") }}
|
{{ $isntDefault := not (or (eq (trim .Site.Params.contentTypeName " ") "posts") (eq (trim .Site.Params.contentTypeName " ") "")) }}
|
||||||
|
{{ $contentTypeName := cond $isntDefault (string .Site.Params.contentTypeName) "posts" }}
|
||||||
|
{{ $paginator := .Paginate (where .Data.Pages "Type" $contentTypeName) }}
|
||||||
|
|
||||||
{{ range $paginator.Pages }}
|
{{ range $paginator.Pages }}
|
||||||
<div class="post on-list">
|
<div class="post on-list">
|
||||||
<h1 class="post-title"><a href="{{ .Permalink }}">{{ .Title | markdownify }}</a></h1>
|
<h1 class="post-title"><a href="{{ .Permalink }}">{{ .Title | markdownify }}</a></h1>
|
||||||
|
Loading…
Reference in New Issue
Block a user