We've retired the forum in favor of GitHub Discussions.

New conversations can be started on GitHub. Existing conversations will remain for a while longer.

Head over to GitHub →

Show entries from collection in "pages from"

Kaz van Kooten May 5, 2020 by Kaz van Kooten

I'm setting up a Statamic site in which my client can create pages and mount collections to that pages. Site is still in local development.

I currently have two pages: training and consultancy. These are children pages of the page services.

There are also two collections: training services and consultancy services.

As you'd expect, training services is mounted to the page training and consultancy services is mounted to the page consultancy.

On the homepage I have the following code:

{{ pages from="/services" }}

<div class="services-area">
  {{ title }}

  // Here I would like to show two or three entries from the mounted collection.

  <a href="{{ url }}">All services in {{ title }}</a>
</div>

{{ /pages }}


So. What I would like to do but don't know how — I'd like to show two or three entries from the collection that is mounted to the page.

This piece of code renders two "services-area" divs and I know how to pull the data from the pages, but not how to pull the data from the collections that are mounted to the pages.

Answered by Kaz van Kooten!
>>>>>>> Answered <<<<<<<
2 Replies
2 Followers