Hello! I’m setting up related pages on my blueprint, that use the same template. I’ve been following the instructions from here to retrieve pages with a specific template, but the query results in empty results when using the panel.
The template is “guideline”:
query: page.index.filterBy('template', 'in', ['guideline'])
I know in general the template is fine because I’m also using it on the homepage template and it’s working:
<?php $items = $pages->template('guideline'); if($items and $items->isNotEmpty()):?>
But in the blueprint case, I’m not sure what’s the problem. Ideally I’d also hide the current page from the options, but now nothing is showing.
This is the full example in case anything else is interfering with this (I don’t think so, since removing the query does list all pages.)
sidebar:
width: 1/3
sections:
metadata:
type: fields
fields:
longTitle:
label: Long title
type: text
buttons: false
summary:
type: textarea
maxlength: 1000
buttons: false
featured:
label: Image preview
type: files
uploads:
template: image
layout: cards
image:
cover: true
related:
label: Related Pages
type: pages
query: page.index.filterBy('template', 'in', ['guideline'])
gallery:
type: files
template: image
But I’m unsure where my mistake is.