Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Content & Markdown

Page find with wildcard

Solved by Sjoerd Smeets View solution

Started by Sjoerd Smeets 6 years ago · 3 replies · 591 views
6 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?

6 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
6 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.

6 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, 8 months ago
6 99 8 months ago
Content & Markdown · by Ton Haarmans, 1 year ago
10 186 1 year ago
Content & Markdown · by Jan L'Am, 1 year ago
4 148 1 year ago
Content & Markdown · by Leonardo, 1 year ago
3 62 1 year ago
Content & Markdown · by belthasar, 1 year ago
4 257 1 year ago