Skip to content
This repository has been archived by the owner on Jun 10, 2023. It is now read-only.

Commit

Permalink
Add contentTypeName to config
Browse files Browse the repository at this point in the history
  • Loading branch information
panr committed Jan 25, 2019
1 parent 27a013b commit b0dfb76
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.md
Expand Up @@ -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"
Expand Down
5 changes: 4 additions & 1 deletion layouts/_default/list.html
@@ -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>
Expand Down

0 comments on commit b0dfb76

Please sign in to comment.