Can I access shortcode section from another page? how?

Hey everybody,

most of my pages have an “intro” section defined via shortcode. I display this in my twig template with this: {{ shortcode.section.intro|raw }}

Now I would like to access this from another page, in a list of child pages produced by a for loop, like so:

{% for p in page.children.published %}
    {{ p.media.images|first.html()|raw }}
    {{ p.shortcode.section.intro|raw }}
{% endfor %}

However, in the loop p.shortcode returns null (whereas the image shows up fine, so I’m thinking shortcodes might just not work like that). Does anybody know how to solve this?

Many thanks for your time & thoughts!

@Netzhexe, Have you had a chance to read the README of shortcode-core?

1 Like

Oh! Do you know, I had it open in another tab, but apparently I was blind yesterday?? Sorry about that, and thank you!

On the other hand, I changed tack after posting this and utilised Grav’s built-in summary function which I don’t think I’ve ever used for anything before, and it may actually be the better solution. But now I can consider the pros and cons of both, so that’s wonderful.