Get content from sub folder

Is there a way to get content from a sub folder NOT using the modular functionality? So, for example:
This grabs and loops all images within the folder:

{% for image in page.media.images %}
   {{ image.html }}
{% endfor %}

But I want to grab all images within the current pages sub folder called ‘gallery’ - e.g:

{% for image in page/gallery/.media.images %}
   {{ image.html }}
{% endfor %}

But also do this for content as well, so if a page had a sub folder called ‘about’ then something along the lines of:

{% get from page/about %}
   {{ content }}
{% endfor %}

Is this at all possible?

Thanks,

This little snippet

{% set p=page.find(’/pages/footer’) %}
{{ p.content }}

from this thread may help https://getgrav.org/forum#!/general:modular-as-footer-text

Is page.find scope-limited to start at the top level? I don’t have access to my local dev env, but I imagine you could combine find with page.children to access a specific folder below the current page. Something like:

{% set gallery = page.children.find('/gallery') %}
{% for image in gallery %}
    {{ image.html }}
{% endfor %}

not sure, but you can iterate over the children of a particular page like this
https://learn.getgrav.org/cookbook/twig-recipes#solution

also if you are talking about the children pages of the current page. you can do it with a ‘collection’ like this
https://learn.getgrav.org/content/collections

Thanks all, I worked it out from your examples. You rock.

For everyone else on this Forum to learn from it is interesting to see exactly what worked for you. Could you tell us that? Thanks.

Hi yeah sure, good point. This is probably the wrong way to do it and probably terrible for performance but it works:

{% set slider = page.find('/home/slider') %}
{{ slider.content }}
{% for image in slider.media.images %}
{{ image.cropZoom(600, 400).html() }}
{% endfor %}

It doesn’t work with page.children.find for some reason, but oh well

cool, glad it worked out. FYI per the link in my post above, its not page.children.find but rather page.find(’/blog’).children. Which would return an array of page objects for all the pages that are children of the ‘/blog’ page.

so combining with your code above you could use it like so (not tested, just my interpretation):

{% for blogpost in page.find('/blog').children %}
    {{ blogpost.content }}
    {% for image in blogpost.media.images %}
        {{ image.cropZoom(600, 400).html() }}
    {% endfor %}
{% endfor %}