Skip to content

Commit

Permalink
Merge pull request #37 from gvangool/overwrite-homepage-content
Browse files Browse the repository at this point in the history
Allow easier overwritng of homepage content
  • Loading branch information
vjeantet committed Feb 5, 2017
2 parents ec85fab + d75d4c8 commit 610804a
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 29 deletions.
30 changes: 1 addition & 29 deletions layouts/index.html
Expand Up @@ -91,35 +91,7 @@ <h2 class="page-description">{{ .Site.Params.description }}</h2>

<main id="content" class="content" role="main">

{{ range .Data.Pages }}
{{if eq .Type "index" }}
<div class="index-content post">
{{.Content}}
</div>
{{end}}
{{ end }}

{{ if not ($.Scratch.Get "paginatedSections") }}
{{ if isset .Site.Params "paginatedSections" }}
{{ $.Scratch.Set "paginatedSections" .Site.Params.paginatedSections }}
{{ else }}
{{ $.Scratch.Set "paginatedSections" "post" }}
{{ end }}
{{ end }}

{{ $list := where .Data.Pages "Section" "in" ($.Scratch.Get "paginatedSections") }}
{{ $list := where $list "Section" "!=" "" }}
{{ $paginator := .Paginate ( $list ) }}

<div class="extra-pagination inner">
{{ partial "pagination.html" $paginator }}
</div>

{{ range $index, $page := $paginator.Pages }}
{{ partial "li.html" . }}
{{ end }}

{{ partial "pagination.html" $paginator }}
{{ partial "home-content.html" . }}

</main>

Expand Down
29 changes: 29 additions & 0 deletions layouts/partials/home-content.html
@@ -0,0 +1,29 @@
{{ range .Data.Pages }}
{{if eq .Type "index" }}
<div class="index-content post">
{{.Content}}
</div>
{{end}}
{{ end }}

{{ if not ($.Scratch.Get "paginatedSections") }}
{{ if isset .Site.Params "paginatedSections" }}
{{ $.Scratch.Set "paginatedSections" .Site.Params.paginatedSections }}
{{ else }}
{{ $.Scratch.Set "paginatedSections" "post" }}
{{ end }}
{{ end }}

{{ $list := where .Data.Pages "Section" "in" ($.Scratch.Get "paginatedSections") }}
{{ $list := where $list "Section" "!=" "" }}
{{ $paginator := .Paginate ( $list ) }}

<div class="extra-pagination inner">
{{ partial "pagination.html" $paginator }}
</div>

{{ range $index, $page := $paginator.Pages }}
{{ partial "li.html" . }}
{{ end }}

{{ partial "pagination.html" $paginator }}

0 comments on commit 610804a

Please sign in to comment.