Load testimonials by tag instead of by name
- Allow loading testimonials by tag instead of name. - Remove the code to load testimonials by name. - Add a `limit` and `offset` to create different lists on the same page - e.g. on the team coaching page where I have two testimonial sections.
This commit is contained in:
parent
59bb9af6d1
commit
fc3e30eddd
9 changed files with 46 additions and 78 deletions
|
@ -1,36 +1,19 @@
|
|||
{% set defaultNames = [
|
||||
"Matthieu Scarset",
|
||||
"Mike Karthauser",
|
||||
"Tawny Bartlett",
|
||||
"Joe Howell",
|
||||
"Jon Hallett",
|
||||
"Michael Itkoff",
|
||||
"Mick Felton",
|
||||
"Duncan Davidson",
|
||||
"Adam Cuddihy",
|
||||
"Huw Davies",
|
||||
"Scott Euser",
|
||||
"Brian Hartwell",
|
||||
"Alan Hatch",
|
||||
"Holly Ross",
|
||||
"Josh Mitchell",
|
||||
"Brian Healy",
|
||||
"Chris Jarvis",
|
||||
"Daniel Easterbrook",
|
||||
"Anonymous",
|
||||
] %}
|
||||
{% set limit = limit ?? 10 %}
|
||||
{% set offset = offset ?? 0 %}
|
||||
|
||||
{% if not merge %}
|
||||
{% set names = names|default(defaultNames) %}
|
||||
{% else %}
|
||||
{% set names = names|merge(defaultNames) %}
|
||||
|
||||
{% set testimonials = site.testimonials %}
|
||||
{% if tag is not null %}
|
||||
{% set testimonials = testimonials|filter(testimonial => tag in testimonial.tags) %}
|
||||
{% endif %}
|
||||
|
||||
{% set testimonials = testimonials|slice(offset, limit) %}
|
||||
|
||||
<section>
|
||||
<h2 class="text-xl font-bold">{{ title|default('Testimonials') }}</h2>
|
||||
|
||||
<div class="mt-4 space-y-12">
|
||||
{% for testimonial in site.testimonials|filter(testimonial => names is null or testimonial.name in names) %}
|
||||
{% for testimonial in testimonials %}
|
||||
<div>
|
||||
<div class="italic prose prose-p:text-black prose-a:font-light prose-a:text-blue-primary prose-p:text-lg prose-blockquote:border-blue-primary dark:marker:text-white prose-li:my-1 prose-li:text-lg prose-figcaption:text-white prose-li:text-black marker:text-black dark:prose-p:text-white dark:prose-invert dark:prose-a:text-blue-400 dark:prose-blockquote:border-blue-400 dark:prose-li:text-white hover:prose-a:no-underline prose-h2:text-xl prose-code:font-normal prose-h2:mb-4 prose-ul:my-3 dark:prose-hr:border-grey-400 prose-code:before:content-[''] prose-code:after:content-['']">
|
||||
<blockquote>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue