I am looping over a page’s subpages using {% for p of page.collection %}
and then dump the shortcodes using
{{ dump(p.contentMeta.shortcodeMeta.shortcode) }}
.
The dump of the shortcode object always contains the values of the very first subpage (while p.raw_content is correct). I think that’s … wrong. Or am I doing it wrong? I would assume, that p.contentMeta.shortcodeMeta
should always be the shortcodes of the page that p
refers to.
So as an example, if I have three subpages, each one containing this (with an increasing number for example):
[section name="text"]This is from subpage 1[/section]
and my main page looks like this:
{% for p in page.collection %}
{{ dump(p.contentMeta.shortcodeMeta.shortcode.section.text) }}
{% endfor %}
the output is
This is from subpage 1
This is from subpage 1
This is from subpage 1
instead of
This is from subpage 1
This is from subpage 2
This is from subpage 3
which is what I would expect…
I am super new to this whole Twig world, am I doing it wrong? Any help would be appreciated.