Hi everyone, I have a question.
I created an FAQ partial and I want to add it dynamically to any page getting an ID from frontmatter.
This is my Data structure. I like to separate the languages using folders.
My frontmatter is:
---
title: Example
slug: 'example'
faqId: 'id'
To access my data files I need to allow access in all languages because my website has a multilingual mode:
{{ $data := index .Site.Data .Site.Language.Lang }}
I’m having a problem with the range, when I manually put the faqID it works.
{{ range $data.faq.faqId }}
When I try to get the frontmatter variable, for some reason it doesn’t work. I’ve seen some examples with two ranges or with, but I wanted to know the best way to do this.
Example:
{{ range $data.faq(.Params.faqId) }}
I know the structure isn’t right. This example is just to exemplify what I’m trying to do.
I preferred to create the FAQ as a date file because I don’t want to make individual pages for each FAQ and I also didn’t use taxonomy because that’s not what I want.