Skip to content
Grav 2.1 is out: every page speaks Markdown. Read the announcement →

Page find with wildcard

Solved by Sjoerd Smeets View solution

Started by Sjoerd Smeets 7 years ago · 3 replies · 810 views
7 years ago

Hello, i'm trying to build an indexpage for my receptar blog.

All of them are in the same blog but their page name start with;
soup-
maincours-

What i'm trying to do is building an index using this snippet:

{% for p in page.find('/blog/soup*').children if p != page %} <li><a href="{{p.url}}">{{ p.title }}</a></li> {% endfor %}

This ain't working. Is there another way to get the result i'm expecting?

7 years ago

@SjoerdSmeets, Have you considered using taxonomy collections for this?

pages/courses/soup-chicken/default.md :

YAML
---
title: Chicken soup
taxonomy:
   category: soup
   tag: chicken
---
# Chicken soup
7 years ago

I'm using taxonomies, but i don't understand how to build a complete indexpage with all types using taxonomies.

I thought using the find snippet would be easier..

My current manually build indexpage can be found here, but i want to make it dynamic.

7 years ago Solution

Found the solution using taxonomy's.

TWIG
{% for post in taxonomy.findTaxonomy({'tag':'maaltijdsalade'}) %}
<li>{{ post.title }}</li>
{% endfor %}

Suggested topics

Topic Participants Replies Views Activity
Content & Markdown · by Jochen, 11 months ago
6 962 11 months ago
Content & Markdown · by Ton Haarmans, 1 year ago
10 764 1 year ago
Content & Markdown · by Jan L'Am, 2 years ago
4 676 2 years ago
Content & Markdown · by Leonardo, 2 years ago
3 602 2 years ago
Content & Markdown · by belthasar, 2 years ago
4 985 2 years ago