added extra content option for more home page like post views
This commit is contained in:
parent
79bc934c75
commit
18a213cf31
6 changed files with 50 additions and 36 deletions
|
|
@ -19,6 +19,9 @@
|
|||
<ul id="main-nav">
|
||||
<li><a href="/">Home</a></li>
|
||||
<li><a href="/posts">Posts</a></li>
|
||||
{{ range site.Params.extraContentDirs }}
|
||||
<li><a href="/{{ . }}">{{ . | humanize }}</a></li>
|
||||
{{ end }}
|
||||
{{ $pagesDir := .Site.Params.Pages | default (slice "pages") }}
|
||||
{{ $pagesList := where .Site.RegularPages "Section" "in" $pagesDir }}
|
||||
{{ range $pagesList }}
|
||||
|
|
|
|||
23
layouts/partials/home_post_list.html
Normal file
23
layouts/partials/home_post_list.html
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
{{ $allPostsList := .AllPostsList }}
|
||||
{{ $postsList := $allPostsList }}
|
||||
{{ $featuredPostsList := slice }}
|
||||
{{ $pagination := slice }}
|
||||
{{ if site.Params.enableFeatured | default false }}
|
||||
{{ $featuredPostsList = where $allPostsList "Params.featured" true }}
|
||||
{{ $postsList = union (where $allPostsList "Params.featured" false) (where $allPostsList "Params.featured" nil) }}
|
||||
{{ $pagination = (.Ctx.Paginate $postsList).Pages }}
|
||||
{{ if eq .Ctx.Paginator.PageNumber 1 }}
|
||||
{{- partial "featured_articles.html" $featuredPostsList -}}
|
||||
{{ end }}
|
||||
{{ else }}
|
||||
{{ $pagination = (.Ctx.Paginate $postsList).Pages }}
|
||||
{{ end }}
|
||||
|
||||
{{/* pagination */}}
|
||||
<div class="postlist {{ if site.Params.gridView }}gridView{{ end }}" id="postlist">
|
||||
{{ range $pagination }}
|
||||
{{- partial "article_card.html" . -}}
|
||||
{{ end }}
|
||||
</div>
|
||||
<div id="getNextBtnContainer"></div>
|
||||
{{- partial "paginator.html" .Ctx -}}
|
||||
13
layouts/partials/simple_posts_list.html
Normal file
13
layouts/partials/simple_posts_list.html
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
<h2>
|
||||
{{ $title := .Title }}
|
||||
{{ $section := .Section | humanize }}
|
||||
{{ if and (ne $section $title) (ne $section "Tags") (ne $title (printf "%ss" $section)) }}
|
||||
{{ $section }}:
|
||||
{{ end }}
|
||||
{{ if and (eq $section "Tags") (ne $section $title) }}Tag: #{{ end }}{{ $title }}
|
||||
</h2>
|
||||
<ul class="list">
|
||||
{{ range .Pages }}
|
||||
<li><span class="date">{{ .Date.Format "2006-01-02" }}</span> <a href="{{ .Permalink }}">{{ .Title }}</a></li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
Loading…
Add table
Add a link
Reference in a new issue