-
Notifications
You must be signed in to change notification settings - Fork 20
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 refer to wrong subpage when used in loop. #96
Comments
TLDR:
Steps to reproduce:
|
So you'll have to evaluate the Page by forcing the caching by navigating there? That seems like a very painstaking process. I suggested on Discord that he use FrontMatter instead as that's more readily available and easier to maintain validation for in editing from Admin. |
I have the same issue with a template which i wrote in 2018. It was working, when it was delivered. So this might help. Sorry but i cannot say when exactly the code didnt work anymore. I've got the call from my client 2 weeks ago. This issue wasnt fixed for month now, so i guess it will not fixed soon. I hope this can be helpful. {% for _p in page.collection %}
{% set _s = _p.contentMeta.shortcodeMeta.shortcode.section %}
<h2>{{_s.headline}}</h2>
.
..
...
<p>{{_s.description}}</p>
{% endfor %} Page structure
The shortcodeobject got the sections of the sp-modular.md and of the first spi-modular.md for every loop. I like the concept of sections. It's easy to read in the backend (especially when it comes to long text) and it's the common way to put content into grav. Sure u can use the Frontmatter instead, but imo the frontmatter should be used for settings not for content. Best regards. |
A workaround suggested in getgrav#87. Likely addresses getgrav#96 and getgrav#97 as well.
A workaround suggested in getgrav#87. Likely addresses getgrav#96 and getgrav#97 as well.
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 thatp
refers to.The text was updated successfully, but these errors were encountered: