|
| 1 | +{{/* testimonials.html partial - displays company testimonials using card design */}} |
| 2 | + |
| 3 | +<section class="testimonials-section mtb-192"> |
| 4 | + <div class="container"> |
| 5 | + <div class="row"> |
| 6 | + <div class="col-md-12 text-center"> |
| 7 | + {{ $section := .Site.GetPage "Section" "testimonials" }} |
| 8 | + <h2 class="title-2">{{ with $section.Params.title }}{{ . }}{{ else }}Trusted by teams <span>building with MemMachine.</span>{{ end }}</h2> |
| 9 | + <!-- <p class="subtitle">{{ with $section.Params.subtitle }}{{ . }}{{ else }}Real feedback from teams using MemMachine{{ end }}</p> --> |
| 10 | + </div> |
| 11 | + </div> |
| 12 | + <div class="testimonials-list row justify-content-center"> |
| 13 | + {{ $max := .max | default 4 }} |
| 14 | + {{/* 1. Get all pages from the "testimonials" section */}} |
| 15 | + {{ $all_testimonials := where site.RegularPages "Section" "testimonials" }} |
| 16 | + |
| 17 | + {{/* 2. Create an empty list to hold only testimonials that are not drafts */}} |
| 18 | + {{ $published_testimonials := slice }} |
| 19 | + {{ range $all_testimonials }} |
| 20 | + {{ if not .Params.draft }} |
| 21 | + {{ $published_testimonials = $published_testimonials | append . }} |
| 22 | + {{ end }} |
| 23 | + {{ end }} |
| 24 | + |
| 25 | + {{/* 3. Set the testimonials to be displayed */}} |
| 26 | + {{ $testimonials_to_display := $published_testimonials | first $max }} |
| 27 | + |
| 28 | + {{/* --- End Logic --- */}} |
| 29 | + |
| 30 | + {{ if gt (len $testimonials_to_display) 0 }} |
| 31 | + {{ range $testimonials_to_display }} |
| 32 | + {{ $page := . }} |
| 33 | + <div class="col-md-4 mb-4"> |
| 34 | + <div class="insight-single-card testimonial-card"> |
| 35 | + {{ $image_path := $page.Params.logo }} |
| 36 | + {{ $image_url := "" }} |
| 37 | + {{ if $image_path }} |
| 38 | + {{ if strings.HasPrefix $image_path "http" }} |
| 39 | + {{ $image_url = $image_path }} |
| 40 | + {{ else }} |
| 41 | + {{ $image_resource := $page.Resources.GetMatch $image_path }} |
| 42 | + {{ if $image_resource }} |
| 43 | + {{ $image_url = $image_resource.RelPermalink }} |
| 44 | + {{ else }} |
| 45 | + {{ $image_url = $image_path | relURL }} |
| 46 | + {{ end }} |
| 47 | + {{ end }} |
| 48 | + {{ end }} |
| 49 | + {{ if $image_url }} |
| 50 | + {{ with $page.Params.company_url }} |
| 51 | + <a href="{{ . }}" target="_blank" rel="noopener"> |
| 52 | + <img src="{{ $image_url }}" alt="{{ $page.Params.company }} logo" class="testimonial-logo" loading="lazy" style="height: 70px; width: auto; max-width: 100%; display: block; margin-left: auto; margin-right: auto; object-fit: contain;"/> |
| 53 | + </a> |
| 54 | + {{ else }} |
| 55 | + <img src="{{ $image_url }}" alt="{{ $page.Params.company }} logo" class="testimonial-logo" loading="lazy" style="height: 70px; width: auto; max-width: 100%; display: block; margin-left: auto; margin-right: auto; object-fit: contain;"/> |
| 56 | + {{ end }} |
| 57 | + {{ else }} |
| 58 | + {{ with $page.Params.company_url }} |
| 59 | + <h3 class="title-3 testimonial-company" style="margin-bottom: 37px;"><a href="{{ . }}" target="_blank" rel="noopener" style="color: var(--light-700);">{{ $page.Params.company }}</a></h3> |
| 60 | + {{ else }} |
| 61 | + <h3 class="title-3 testimonial-company" style="margin-bottom: 37px;">{{ $page.Params.company }}</h3> |
| 62 | + {{ end }} |
| 63 | + {{ end }} |
| 64 | + <div class="testimonial-content"> |
| 65 | + <blockquote>{{ $page.Content }}</blockquote> |
| 66 | + <div class="testimonial-meta"> |
| 67 | + <span class="testimonial-author">{{ $page.Params.author }}</span> |
| 68 | + <span class="testimonial-company">, |
| 69 | + {{ with $page.Params.company_url }} |
| 70 | + <a href="{{ . }}" target="_blank" rel="noopener">{{ $page.Params.company }}</a> |
| 71 | + {{ else }} |
| 72 | + {{ $page.Params.company }} |
| 73 | + {{ end }} |
| 74 | + </span> |
| 75 | + </div> |
| 76 | + </div> |
| 77 | + </div> |
| 78 | + </div> |
| 79 | + {{ end }} |
| 80 | + {{ else }} |
| 81 | + <div class="col-md-12 text-center"> |
| 82 | + <p>No testimonials available.</p> |
| 83 | + </div> |
| 84 | + {{ end }} |
| 85 | + </div> |
| 86 | + </div> |
| 87 | +</section> |
0 commit comments