Condition & front matter variable working in single but not partial

I’ve got this snippet that works fine in my single.html:

  {{ if .Params.showMeta }}
  <p class="u-meta">
    {{ partial "date.html" (dict "date" .Date) }}
  </p>
  {{ end }}

But that same snippet doesn’t do anything in a partial called item-card that renders on the list.html when it’s included there via {{- partial "item-card.html" . -}} or on the homepage like this:

    {{ range first 1 (where .Site.Pages "Section" "podcast")}}
    {{- partial "item-card.html" . -}}
    {{ end }}

Can anyone explain why? I’ve been reading the docs a lot and have searched the forum but I’m coming up empty so far. I’m confused because .Params.title and .Params.description render correctly later on in that partial.

Silly question, but do you have ‘date’ in your frontmatter for the page for which you are creating a card?

I do, and the date renders on when that page is sent through the single.html template.

I’m using YAML for the front matter; it looks like this:

---
title: 'my title'
date: 2023-03-17
description: 'my description'
showMeta: true
---

Ouch, I’m just a dope :laughing:

The whole thing was wrapped in another (unsatisfied) conditional that I failed to notice. Works fine.

¯\_(ツ)_/¯

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.