mirror of
https://github.com/thomasjsn/hugo-theme-hello-friend.git
synced 2024-12-24 14:59:27 +01:00
Add contentTypeName to config
This commit is contained in:
parent
27a013b809
commit
b0dfb769d1
@ -65,6 +65,8 @@ paginate = 5
|
||||
|
||||
[params]
|
||||
subtitle = "A simple theme for Hugo"
|
||||
# dir name for your list content
|
||||
contentTypeName = "posts"
|
||||
# "light" or "dark"
|
||||
defaultTheme = "dark"
|
||||
|
||||
|
@ -1,6 +1,9 @@
|
||||
{{ define "main" }}
|
||||
<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 }}
|
||||
<div class="post on-list">
|
||||
<h1 class="post-title"><a href="{{ .Permalink }}">{{ .Title | markdownify }}</a></h1>
|
||||
|
Loading…
Reference in New Issue
Block a user