Add main index page

The main index page shows only `mainSections` ("post" by default). You can set sections with "mainSections" config parameter.
This commit is contained in:
vimux 2018-05-23 09:37:31 +03:00
parent 37b761904a
commit 0ed9f70323
No known key found for this signature in database
GPG key ID: 5A34FDC4EE832E34
2 changed files with 15 additions and 0 deletions

View file

@ -29,6 +29,7 @@ description = "John Doe's Personal blog about everything" # Description of your
opengraph = true # Enable OpenGraph if true
twitter_cards = true # Enable Twitter Cards if true
cardsPerRow = 2 # Possible values: 1, 2, 3
#mainSections = ["post"] # Set main page sections
#dateFormat = "2006-01-02" # change the format of dates
[outputFormats]

14
layouts/index.html Normal file
View file

@ -0,0 +1,14 @@
{{ partial "header.html" . }}
<div class="main">
<div class="cards">
{{ $mainSections := .Site.Params.mainSections | default (slice "post") }}
{{ $paginator := .Paginate ( where .Data.Pages "Section" "in" $mainSections ) }}
{{ range $paginator.Pages }}
<div class="card{{ with .Site.Params.cardsPerRow }} card--{{ . }}col{{ else }} card--2col{{ end }}">
{{ .Render "summary" }}
</div>
{{ end }}
</div>
{{ partial "pagination.html" . }}
</div>
{{ partial "footer.html" . }}