Relatedpages not seeing posts in subdirs

I just split my user/pages/ into


Within each folder are various posts of type ‘dsposts’ and ‘oposts’.

But when I did that the relatedpages stopped working :confused: When they are all in the same folder, relatedpages works

I have been editing 7 or 8 different files to try and get the config correct, but I am at my wit’s end at this point what else to edit.


I have edited my to be

        - @page: /blog/dsposts
        - @page: /blog/oposts

and in both and I have

        - @self.children

The posts in /dsposts, in, has (only relevent line shown)

blogtype: dsblog
    category: blog
    tag: [Argentina]
    type: dspost

And the posts in /oposts, in, has

blogtype: oblog
    category: blog
    tag: [Argentina]
    type: opost

In user/config/plugins/relatedpages.yaml I have tried the various setting for filter.items

@page: /blog
@page: /blog/dsposts, 
@taxonomy: tag
@taxonomy: type
@page: blogtype (defined in

where ‘type’ in a taxonomy in site.yaml as defined as either ‘dsblog’ or ‘oblog’ in

the plugins/relatedpages/blueprints.yaml has

        type: multilevel
        value_only: true
        type: array

From the plugin documentation and the learn grav pages I deducted that you possible need to apply a filter like

@page.descendants’: ‘/blog’

And additionally filter for type: item

Collection options:

Complex collections:

So the filter in relatedpages.yaml should perhaps look like:

        @page.descendants: /blog
    type: item
1 Like

NICE! I had tried @self.descendants. but that did nothing, so I am obviously still not clear on the scope and meaning of some references. I did not try @page.descendant’ (yet) because the posts have no descendants, and I assumed ‘page’ referred to the current page and ‘self’ referred to the page that loaded the controller (/blog), which does have descendants.

Anyway, your suggestion worked like a charm! I did not use “type: item” because I am not sure what that actually means. Is “type” referring to my type in the taxonomy in relatedpages.yaml? No matter what I enter there, it makes no difference in the output… “type: xmas” or “type: blog”, no diff. But I will shelve that for later. Thanks!

As listed in the docs, type refers to the template used. I assume you use the item template for blog posts in both folders. If you omit type, then the pages rendered with the blog template (in your 2 sub folders) will be added to the collection, too.

Ah, ok. But I am still a bit confused…

The docs refer to anything that is a twig and in the templates folder as a template or at least one form of template. For example



So, “blog” and “sidebar” would then be the “type”, yes?

It’s unfortunate they refer to them as “types” rather than just “templates” because there are like a dozen different meanings for “type” depending on the context, so it’s a bit confusing at first.

In the relatedpages.yaml you sent is has a “type” entry



@page.descendants: /blog

type: xmas

How would I know that this “type” refers to page type and not collection type, taxonomy type, or some homemade type? I actually did search the docs for what the meant by “type”, and it only muddied the waters more, but I did manage to find the part of a sentence that said “… type which takes a single template-name”. I have read, but as my “type: xmas” is not working, I assume I am not reading the relevant section.

I would love to see comments in the YAML files, like the php.ihi, for example, where, of the 1537 lines, 1390 of them are comments explaining each element and options. At least a comment pointing to the doc link that explains what I am looking at and what I can do with it because I am still looking through the docs to see where this is explained.

In any case. thanks again for your help, it was right-on.