Use intermediate collection page to control siblings

So the heart of my problem is the manual page sorting. I have a page called ‘channel’ which encapsulates multiple releases and articles, which are shown in their respective sections. The manual sorting via ‘Change Position’ allows sorting across all siblings, so releases and articles are mixed together there which is not desirable. Sorting should only happen as article <-> article and release <-> release.

To circumvent this my approach is to create intermedia ‘collection’ pages ‘releases’ and ‘articles’ so e.g. the article parent is ‘articles’ and not ‘channel’ which would solve the sorting problem (I hope).
I can’t get this to work though, the articles are still saved under the parent ‘channel’ and not ‘articles’.

If there is an easier solution than this please rather point it out to me instead of reviewing my own approach :slight_smile:

Here are my blueprints for articles (same for releases, also redacted irrelevant stuff):

pages/channel.yml:

title: Channel

columns:
  - width: 1/1
    sections:
      articles:
        type: pages
        headline: Artikel
        templates:
          - article

pages/articles.yml:

title: Articles
type: pages
headline: Articles
parent: site.find("channel")
templates:
  - article

pages/article.yml:

title: Article
icon: 📄
parent: site.find("articles")

columns:
  content:
    width: 2/3
    ...

You cannot set a parent here… Please remove.

Your articles section in channel.yml is missing the parent attribute, it’s not required though and current page (channel) will be used as parent.

However, your pages/articles blueprint looks weird, there is no section defined, or only half a section (im irritated by the title attribute there), in any case this thingy also uses the channel page as parent.

For manual sorting, you have no other way then separating the parents.

Yes the page/articles blueprint was just written by me since I did not intend it for anyone to directly view it or change articles from there. I added a single section containing pages of template ‘article’ for now.

But it seems like I don’t get the parents attribute yet. Since I want the final directory structure to be:

channel
├── articles
│   ├── article1
│   └── article2
├── releases
│   ├── release1
│   └── release2

I thought I’d have to set the blueprint of article to site.find('articles') and the parent of articles to site.find('channel'), right? Where would be the proper place for this if not in the pages root properties?

In channel.yml, you would set up two sections:

title: Channel # The blueprint used by the channel pages
# other settings
sections:
  articles:
    type: pages
    parent: page.children.find('articles') # use articles subpage as parent for section
    template: article # assuming that article1, 2 etc. use the article blueprint
  releases:
    type: pages
    parent: page.children.find('releases') # use releases subpage as parent for section
   template: release # assuming that release1, 2 etc, use the release.yml blueprint

Then you would probably set up the articles section also in articles.yml, and the releases section also in releases.yml

Do you use the same blueprint for the articles and releases pages? It helps to understand the structure if you always also add the content file names you use inside the folders…

I set it up as you said and I get this error in the channel overview:
The section "articles" could not be loaded: The parent for the query "page.children.find('articles')" cannot be found in the section "articles"
This is the same error I got when I tried out kirby.page('articles') and site.find('articles') FYI

Do you use the same blueprint for the articles and releases pages?

If this is possible I would use the same but for now these are separate blueprints. To visualize (adding the txt files seemed to make it worse for me though, hence why I didn’t add them in the first place):

channel
├── channel.txt
├── articles
│   ├── articles.txt
│   └── article
│        └── article.txt
├── releases
│   ├── releases.txt
│   └── release
│        └── release.txt

Are the articles and releases pages (i.e. the two subpages of channel) still drafts?

The query should work if the pages are not drafts and the slugs are correct.

There are no articles and releases pages yet, I haven’t been able to create them via the panel since they are not directly referenced in the channel overview yet. (I also would like not to add this extra step for my users)

Well, if they don’t exist, the code I provided cannot possibly work. From the structure you posted above, I was assuming you had created these pages.

Sorry to mislead you there, this was the intended structure, not the actual one.
That the intention behind my question - what do I have to do to get it like this.

I already explained that above, but I didn’t know that you had problems setting up those pages.

Additionally, add the pages in the filesystem. I don’t know if it is really necessary to create them from the Panel or set up an additional section for them.

You can also set up an additional section either in channel.yml for these parent pages if you want to show them.

(post withdrawn by author, will be automatically deleted in 24 hours unless flagged)

Nevermind, manually creating them worked, thanks!
Now I will just have to add some sort of script to automatically create them for new channels :slight_smile:

Will post here for future reference!