Assign template context to var
This commit is contained in:
@@ -1,41 +1,43 @@
|
||||
{{ if .Pages }}
|
||||
{{ if .Params.paige.show_full_pages }}
|
||||
{{ $p := .Paginate .Pages }}
|
||||
{{ $page := . }}
|
||||
|
||||
{{ if $page.Pages }}
|
||||
{{ if $page.Params.paige.show_full_pages }}
|
||||
{{ $p := $page.Paginate $page.Pages }}
|
||||
<section>
|
||||
{{ range $p.Pages }}
|
||||
{{ .Scratch.Set "paige_show_full_pages" true }}
|
||||
{{ partial "paige/article.html" . }}
|
||||
{{ $page.Scratch.Set "paige_show_full_pages" true }}
|
||||
{{ partial "paige/article.html" $page }}
|
||||
{{ end }}
|
||||
</section>
|
||||
{{ if or $p.HasPrev $p.HasNext }}
|
||||
<section>
|
||||
<div class="d-flex justify-content-center">
|
||||
{{ partial "paige/pagination.html" . }}
|
||||
{{ partial "paige/pagination.html" $page }}
|
||||
</div>
|
||||
</section>
|
||||
{{ end }}
|
||||
{{ else }}
|
||||
{{ $p := .Paginate (.Pages.ByDate.Reverse.GroupByDate "January 2006") }}
|
||||
{{ $p := $page.Paginate ($page.Pages.ByDate.Reverse.GroupByDate "January 2006") }}
|
||||
<section>
|
||||
{{ range $p.PageGroups }}
|
||||
{{ if $.Param "paige.page_list.date_header.hide" | not }}
|
||||
{{ if $page.Param "paige.page_list.date_header.hide" | not }}
|
||||
<h2 class="{{ $.Param `paige.page_list.date_header.class` | default `h5 text-center` }}">{{ .Key }}</h2>
|
||||
{{ end }}
|
||||
{{ range .Pages }}
|
||||
{{ $class := "text-center" }}
|
||||
|
||||
{{ $authors := cond ($.Param "paige.page_list.authors.show" | not) "" (partial "paige/func-authors.html" .) }}
|
||||
{{ $authorsclass := $.Param "paige.page_list.authors.class" | default (print $class " text-secondary") }}
|
||||
{{ $date := cond ($.Param "paige.page_list.date.show" | not) "" .PublishDate }}
|
||||
{{ $dateclass := $.Param "paige.page_list.date.class" | default (print $class " text-secondary") }}
|
||||
{{ $description := cond ($.Param "paige.page_list.description.hide" | not) (.Description | markdownify) "" }}
|
||||
{{ $descriptionclass := $.Param "paige.page_list.description.class" | default $class }}
|
||||
{{ $authors := cond ($page.Param "paige.page_list.authors.show" | not) "" (partial "paige/func-authors.html" .) }}
|
||||
{{ $authorsclass := $page.Param "paige.page_list.authors.class" | default (print $class " text-secondary") }}
|
||||
{{ $date := cond ($page.Param "paige.page_list.date.show" | not) "" .PublishDate }}
|
||||
{{ $dateclass := $page.Param "paige.page_list.date.class" | default (print $class " text-secondary") }}
|
||||
{{ $description := cond ($page.Param "paige.page_list.description.hide" | not) (.Description | markdownify) "" }}
|
||||
{{ $descriptionclass := $page.Param "paige.page_list.description.class" | default $class }}
|
||||
{{ $flags := slice }}
|
||||
{{ $gap := "mb-0" }}
|
||||
{{ $summary := cond ($.Param "paige.page_list.summary.show" | not) "" (.Summary | strings.TrimPrefix "<p>" | strings.TrimSuffix "</p>") }}
|
||||
{{ $summaryclass := $.Param "paige.page_list.summary.class" | default $class }}
|
||||
{{ $title := cond ($.Param "paige.page_list.title.hide" | not) (.Title | markdownify) "" }}
|
||||
{{ $titleclass := $.Param "paige.page_list.title_class" | default $class }}
|
||||
{{ $summary := cond ($page.Param "paige.page_list.summary.show" | not) "" (.Summary | strings.TrimPrefix "<p>" | strings.TrimSuffix "</p>") }}
|
||||
{{ $summaryclass := $page.Param "paige.page_list.summary.class" | default $class }}
|
||||
{{ $title := cond ($page.Param "paige.page_list.title.hide" | not) (.Title | markdownify) "" }}
|
||||
{{ $titleclass := $page.Param "paige.page_list.title.class" | default $class }}
|
||||
|
||||
{{ if .Draft }}
|
||||
{{ $flags = $flags | append "paige-draft" "paige-unpublished" }}
|
||||
@@ -78,7 +80,7 @@
|
||||
{{ if or $p.HasPrev $p.HasNext }}
|
||||
<section>
|
||||
<div class="d-flex justify-content-center">
|
||||
{{ partial "paige/pagination.html" . }}
|
||||
{{ partial "paige/pagination.html" $page }}
|
||||
</div>
|
||||
</section>
|
||||
{{ end }}
|
||||
|
Reference in New Issue
Block a user