diff --git a/layouts/partials/paige/page.html b/layouts/partials/paige/page.html new file mode 100644 index 00000000..bd49d3fd --- /dev/null +++ b/layouts/partials/paige/page.html @@ -0,0 +1,98 @@ +{{ $authors := partial "paige/authors.html" . }} +{{ $categories := .Params.categories | default slice | uniq }} +{{ $commiturl := "" }} +{{ $date := .PublishDate }} +{{ $dateformat := .Param "paige.date.format" | default ":date_long" }} +{{ $description := .Description | markdownify }} +{{ $draft := .Draft }} +{{ $expired := and .ExpiryDate (lt .ExpiryDate now) }} +{{ $flags := slice }} +{{ $future := and .PublishDate (gt .PublishDate now) }} +{{ $modified := and .PublishDate .Lastmod (lt .PublishDate .Lastmod) }} +{{ $pinned := .Params.paige.pin }} +{{ $readingtime := .ReadingTime }} +{{ $summary := .Summary | htmlUnescape | plainify }} +{{ $tags := .Params.tags | default slice | uniq }} +{{ $title := .Title | markdownify }} +{{ $titlelink := .RelPermalink }} + +{{ if and (.Param "paige.git.commit_url_prefix") .GitInfo }} + {{ $commiturl = print (.Param "paige.git.commit_url_prefix") .GitInfo.Hash }} +{{ end }} + +{{ if $draft }} + {{ $flags = $flags | append "paige-draft" "paige-unpublished" }} +{{ end }} + +{{ if $expired }} + {{ $flags = $flags | append "paige-expired" "paige-unpublished" }} +{{ end }} + +{{ if $future }} + {{ $flags = $flags | append "paige-future" "paige-unpublished" }} +{{ end }} + +{{ if $modified }} + {{ $flags = $flags | append "paige-modified" }} +{{ end }} + +{{ if not (or $draft $expired $future) }} + {{ $flags = $flags | append "paige-published" }} +{{ end }} + +{{ $flags = delimit ($flags | uniq) " " }} +{{ $class := delimit (slice "mb-3" "paige-page" "w-100" | append $flags | uniq | sort) " " }} + +
+ {{ with $title }} +

{{ if $pinned -}} Pinned page {{ end }}{{ . }}

+ {{ end }} + + {{ with $description }} +

{{ . }}

+ {{ end }} + + {{ with $summary }} +

{{ . }}

+ {{ end }} + + {{ if or $categories $tags }} +

+ {{ $terms := slice }} + + {{ range $categories }} + {{ $terms = $terms | append (dict "name" . "url" (lower . | printf "categories/%v/" | relLangURL)) }} + {{ end }} + + {{ range $tags }} + {{ $terms = $terms | append (dict "name" . "url" (lower . | printf "tags/%v/" | relLangURL)) }} + {{ end }} + + {{ range sort $terms "name" }} + {{ .name }} + {{ end }} +

+ {{ end }} + + {{ with $authors }} +

{{ . }}

+ {{ end }} + + {{ with $date }} +

+ {{ with $commiturl }} + + {{ end }} + + + + {{ if $commiturl }} + + {{ end }} +

+ {{ end }} + + {{ with $readingtime }} +

{{ . }} {{ i18n "paige_minutes" . }}

+ {{ end }} +
diff --git a/layouts/partials/paige/pages.html b/layouts/partials/paige/pages.html index 324bbeab..c2b697da 100644 --- a/layouts/partials/paige/pages.html +++ b/layouts/partials/paige/pages.html @@ -16,108 +16,15 @@ {{ end }} {{ else }} - {{ $p := $page.Paginate ($page.Pages.ByPublishDate.Reverse.GroupByPublishDate "January 2006") }}
+ {{ range (where $page.Pages "Params.paige.pin" true).ByPublishDate.Reverse }} + {{ partial "paige/page.html" . }} + {{ end }} + {{ $p := $page.Paginate ($page.Pages.ByPublishDate.Reverse.GroupByPublishDate "January 2006") }} {{ range $p.PageGroups }}

{{ .Key }}

{{ range .Pages }} - {{ $authors := partial "paige/authors.html" . }} - {{ $categories := .Params.categories | default slice | uniq }} - {{ $commiturl := "" }} - {{ $date := .PublishDate }} - {{ $dateformat := $page.Param "paige.date.format" | default ":date_long" }} - {{ $description := .Description | markdownify }} - {{ $draft := .Draft }} - {{ $expired := and .ExpiryDate (lt .ExpiryDate now) }} - {{ $flags := slice }} - {{ $future := and .PublishDate (gt .PublishDate now) }} - {{ $modified := and .PublishDate .Lastmod (lt .PublishDate .Lastmod) }} - {{ $readingtime := .ReadingTime }} - {{ $summary := .Summary | htmlUnescape | plainify }} - {{ $tags := .Params.tags | default slice | uniq }} - {{ $title := .Title | markdownify }} - {{ $titlelink := .RelPermalink }} - - {{ if and ($page.Param "paige.git.commit_url_prefix") $page.GitInfo }} - {{ $commiturl = print ($page.Param "paige.git.commit_url_prefix") $page.GitInfo.Hash }} - {{ end }} - - {{ if $draft }} - {{ $flags = $flags | append "paige-draft" "paige-unpublished" }} - {{ end }} - - {{ if $expired }} - {{ $flags = $flags | append "paige-expired" "paige-unpublished" }} - {{ end }} - - {{ if $future }} - {{ $flags = $flags | append "paige-future" "paige-unpublished" }} - {{ end }} - - {{ if $modified }} - {{ $flags = $flags | append "paige-modified" }} - {{ end }} - - {{ if not (or $draft $expired $future) }} - {{ $flags = $flags | append "paige-published" }} - {{ end }} - - {{ $flags = delimit ($flags | uniq) " " }} - {{ $class := delimit (slice "mb-3" "paige-page" "w-100" | append $flags | uniq | sort) " " }} - -
- {{ with $title }} -

{{ . }}

- {{ end }} - - {{ with $description }} -

{{ . }}

- {{ end }} - - {{ with $summary }} -

{{ . }}

- {{ end }} - - {{ if or $categories $tags }} -

- {{ $terms := slice }} - - {{ range $categories }} - {{ $terms = $terms | append (dict "name" . "url" (lower . | printf "categories/%v/" | relLangURL)) }} - {{ end }} - - {{ range $tags }} - {{ $terms = $terms | append (dict "name" . "url" (lower . | printf "tags/%v/" | relLangURL)) }} - {{ end }} - - {{ range sort $terms "name" }} - {{ .name }} - {{ end }} -

- {{ end }} - - {{ with $authors }} -

{{ . }}

- {{ end }} - - {{ with $date }} -

- {{ with $commiturl }} - - {{ end }} - - - - {{ if $commiturl }} - - {{ end }} -

- {{ end }} - - {{ with $readingtime }} -

{{ . }} {{ i18n "paige_minutes" . }}

- {{ end }} -
+ {{ partial "paige/page.html" . }} {{ end }} {{ end }}