How would I go around getting all pages and subpages so I could make like a latest posts list but with all pages and subpages ...
Archive
Have a look at the Pages Object, it allows access to all Grav pages and you can iterate over them to create the desired output.
Get the top-level pages for a simple menu (from the documentation):
TWIG
<ul class="navigation">
{% for page in pages.children %}
{% if page.visible %}
<li><a href="{{ page.url }}">{{ page.menu }}</a></li>
{% endif %}
{% endfor %}
</ul>
---
Added collection to the pages header
YAML
content:
items: '@root.descendants'
and then added this to my template file
TWIG
<ul>
{% for post in page.collection.order('date', 'desc').slice(0, 5) %}
<li class="recent-posts">
<strong><a href="{{ post.url }}">{{ post.title }}</a></strong>
<p>{{post.date|date}}</p>
</li>
{% endfor %}
</ul>
---
Log in to reply.
Suggested topics
| Topic | Participants | Replies | Views | Activity |
|---|---|---|---|---|
| 0 | 1354 | 9 years ago | ||
| 2 | 935 | 9 years ago | ||
| 2 | 4065 | 9 years ago | ||
| 1 | 2953 | 9 years ago | ||
| 3 | 1119 | 9 years ago |