Add option to force show articles button

This commit is contained in:
Mark Dumay
2025-06-07 14:09:51 +02:00
parent 9a30a12547
commit efeabfe8c6
8 changed files with 18 additions and 5 deletions

View File

@@ -19,7 +19,7 @@
{{ end }}
{{ $pages := slice }}
{{ $pages = partial "assets/live-pages.html" (dict
{{ $result := partial "assets/live-pages.html" (dict
"page" $args.page
"section" $args.input.section
"nested" $args.input.nested
@@ -29,6 +29,7 @@
"sort" $args.input.sort
"reverse" $args.input.reverse
)}}
{{ $pages = $result.pages }}
<!-- Add style definitions -->
{{ $styles := slice
@@ -73,6 +74,7 @@
"icon-rounded" $args.iconRounded
"href" (cond $moreButton $moreLink "")
"href-title" (cond $moreButton $moreTitle "")
"href-force" (gt $result.total (len $result.pages))
)}}
{{ if $args.scroll }}

View File

@@ -32,6 +32,9 @@ arguments:
group: partial
href-title:
release: v1.0.0
href-force:
release: v1.0.0
group: partial
separator:
loading:
ratio:

View File

@@ -31,6 +31,7 @@ content_blocks:
section: blog
reverse: true
sort: date
keywords: featured
hide-empty: false
more:
title: More Posts

View File

@@ -4,6 +4,7 @@ title: Bootstrap elements
date: 2023-08-12
description: Use shortcodes to add common Bootstrap elements with ease.
tags: ["bootstrap", "shortcode"]
keywords: featured
thumbnail:
url: img/boots.jpg
author: Nathan Dumlao

View File

@@ -4,6 +4,7 @@ title: Components
date: 2023-09-23
description: Use shortcodes to add predefined components powered by external libraries.
tags: ["bootstrap", "shortcode"]
keywords: ["featured"]
thumbnail:
url: img/puzzle.jpg
author: Ryoji Iwata

View File

@@ -1,9 +1,10 @@
---
author: Mark Dumay
title: Content blocks
date: 2025-05-13
date: 2025-06-07
description: Quickly edit your webpages using reusable content blocks.
tags: ["bookshop", "blocks"]
keywords: ["featured"]
thumbnail:
url: img/pj-accetturo-XpD6Dkui-yg-unsplash.jpg
author: Pj Accetturo

View File

@@ -189,7 +189,7 @@
<div class="pt-3">{{- partial "assets/pagination.html" (dict "page" $args.page "format" "terse") -}}</div>
{{- end -}}
{{- else -}}
{{- if and (gt $count $max) $args.hrefTitle -}}
{{- if or (and (gt $count $max) $args.hrefTitle) (and $args.hrefForce $args.hrefTitle) -}}
{{- $href := $args.href -}}
{{- if and $pretty (not (hasSuffix $href "/" )) (not (strings.Contains $href "#")) -}}
{{- $href = printf "%s/" $href -}}

View File

@@ -15,6 +15,7 @@
{{/* Initialize local arguments */}}
{{ $pages := slice }}
{{ $total := 0 }}
{{/* Main code */}}
{{ if not $args.err }}
@@ -48,15 +49,18 @@
{{ else }}
{{ $pages = where site.Pages (printf ".Params.%s" $args.section) "!=" nil }}
{{ end }}
{{ $total = len $pages }}
{{ else if eq $args.kind "related" }}
{{ if $sectionPage.Keywords}}
{{ if $sectionPage.Keywords }}
{{ $keywords := keyVals "tags" $sectionPage.Keywords }}
{{ $opts := dict "namedSlices" (slice $keywords) }}
{{ $pages = site.RegularPages.Related $opts }}
{{ $total = len $pages }}
{{ end }}
{{ else }}
{{/* Retrieve the immediate or all related pages (recursively), optionally filtering by tag or keyword */}}
{{ if $args.nested }}{{ $pages = $sectionPage.RegularPagesRecursive }}{{ else }}{{ $pages = $sectionPage.Pages }}{{ end }}
{{ $total = len $pages }}
{{ if and $args.tags (gt (len $args.tags) 0) }}
{{ $pages = where $pages "Params.tags" "intersect" $args.tags }}
@@ -77,4 +81,4 @@
{{ end }}
{{ end }}
{{ return $pages }}
{{ return (dict "pages" $pages "total" $total) }}