getgrav / getgrav/grav-plugin-shortcode-core

Shortcodes of subpages do not refer to the correct subpage.

Open
#97 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
47
Forks
17
PR merge metrics
No merged PRs in 30d

Description

I have a page with several subpages:
```
main.md
- sub1.md
- sub2.md
- sub3.md
```
Each subpage contains a shortcode block with unique content, let's say something like
`[section name='text']subpage_1[/section]` with the counter increasing for each subpage.

Now loop over the subpages in the main page and dump the shortcodes (as mentioned in the documentation https://learn.getgrav.org/16/content/content-pages#contentmeta):
```
{% for p in page.collection %}
{{ dump(p) }}
{{ dump(p.contentMeta.shortcodeMeta.shortcode.section.text) }}
{% endfor %}
```
I would expect `p.contentMeta.shortcodeMeta.shortcode.section.text` to always point to the subpage's [text]-element. However it doesn't seem to be the case. It's always refering to the first one, while the "raw_content" property however shows the expected values.

Am I doing it wrong or is this some problem with the shortcodes?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.