Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shortcodes of subpages do not refer to the correct subpage. #97

Open
ptrxyz opened this issue Jul 29, 2020 · 0 comments
Open

Shortcodes of subpages do not refer to the correct subpage. #97

ptrxyz opened this issue Jul 29, 2020 · 0 comments

Comments

@ptrxyz
Copy link

ptrxyz commented Jul 29, 2020

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?

@rhukster rhukster transferred this issue from getgrav/grav Aug 21, 2020
k8n added a commit to k8n/grav-plugin-shortcode-core that referenced this issue Feb 8, 2021
A workaround suggested in getgrav#87. Likely addresses getgrav#96 and getgrav#97 as well.
k8n added a commit to k8n/grav-plugin-shortcode-core that referenced this issue Feb 8, 2021
A workaround suggested in getgrav#87. Likely addresses getgrav#96 and getgrav#97 as well.
rhukster pushed a commit that referenced this issue Mar 10, 2021
A workaround suggested in #87. Likely addresses #96 and #97 as well.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant