I'm trying to merge a page with extra data.
There is now output if I do it the following way.
{% assign extra = site.data.extra | where_exp: "search", "search.stg_kurz == page.stg_kurz" %}
{{ extra.teaser | markdownify }}
But if I do it that way, there is an output, but why?
{% assign extras = site.data.extra | where_exp: "search", "search.stg_kurz == page.stg_kurz" %}
{{ extras.teaser | markdownify }}
{% for extra in extras %}
{{ extra.teaser | markdownify }}
{% endfor %}
There is always only one dataset, that matches the page.variable
Can anyone help or has some tips?
Thanks
My own solution looks like
{% assign stg = site.data.3478_fachrichtung | where_exp: "search", "search.stg_kurz == page.stg_kurz" %}
{% assign extras = site.data.extra | where_exp: "search", "search.stg_kurz == page.stg_kurz" %}
{% assign extra = stg | concat: extras %}
Not perfekt, but it works for me.
site.data.3478_fachrichtung
is the page.data
Has anyone a better solution?
{% assign extra = site.data.extra | where_exp: .... %}
{% assign extra = site.data.extra | where_exp: .... %}
returns an array containing (normally) one element. You just have to grab it with first
array filter before printing it.
{% assign extras = site.data.extra | where_exp: "search", "search.stg_kurz == page.stg_kurz" %}
{% assign extra = extras.first %}
{{ extra.teaser | markdownify }}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.