Hello community! I have HUGO + Netlify CMS project and I really don’t know why this code does not work, as it is simply the same as in doc examples. So I need some clue on where could be the problem? It does not show an error, but literally does nothing, but if I change where operator from “=” to “!=” it lists all articles.
Long story short, here is the code:
{{ $productTitle := .Params.title }} /* Current page title i.e: New Item Description 1*/
{{ range where (where .Site.RegularPages "Section" "blog" ) ".Params.relProd" "=" $productTitle }}
<article class="article">
{{ .Params.title }}
</article>
{{ end }}
Here is example of article.md file:
---
title: Lorem ipsum dolor sit amet, consectetur
date: 2021-04-09T13:17:25.161Z
featuredUrl: /uploads/featuredImage.jpg
relProd: New Item Description 1
---
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Here is part of config.yml file:
- name: "blog"
label: "Blog"
folder: "content/blog"
create: true
fields:
- {label: "Title", name: "title", widget: string }
- {label: "Publish Date", name: "date", widget: datetime }
- {label: "Featured Image", name: "featuredUrl", widget: image }
- {label: "Related Product", name: "relProd", widget: relation,
collection: "products", search_fields: ["title"],
value_field: "title", required: false }
- {label: "Body", name: "body", widget: markdown }
Here is my repo: GitHub - albafox/aurora-de