Specific user content folder

Hello together,

I’m building a little platform for a group of students to upload images. They are only allowed to create and edit their own content, which I achieved trough the isreadable-method.
But is it possible that their content is stored in a own/separate folder, named after the user name? so that we get a url/folder structure like this: domain.etc/username/albumname ?
At the moment all the content the different users create is stored in a folder named after the blueprint: domain.etc/blueprintname/albumname.

thanks for help,
best, radioman

Yes, isn’t that the exact use case described in the cookbook recipe for the isReadable() method?

sorry for getting back so late. With the isReadable() method the pages the users create are stored in one big folder where all the users content is togehter (of course they can only see/edit their own content).

But every user should have their own seperate folder e.g:

Or even better:

Yes, you can of course create a folder for every user, then apply the is readable method to this parent model as well.

can you give me a hint where to dig deeper? How can I change the structure pages are stored?
As far as i understood, new pages are always stored in “content” -> “blueprintname” -> “title”?
I would need “content” -> “username” -> “title”. The “username” comes from the author field.

Well, you cannot move pages around in the Panel, so as a first step you would have to either create user folders manually and move the subpages that belong to an author inside in the filesystem.

Or you write a little scripts that does this automatically, i.e. plucks all authors into an array, then loop through this array, create a new page for each author, then move the pages that belong to each other inside that newly created author folder.

New pages are not always direct children of content, you can easily build a tree structure. See the Starterkit for an example.

ok, that helps, thank you. So I would need a dynamic system, manually move the subpages will not be possible as the users will create around 10 pages and they should be automaticaly sorted.

There is no way to change the section blueprint
parent: kirby.page("photography")
to something like
parent: kirby.page("{{ page.author }}")
parent: site.find("{{ page.author }}")

But if their is a folder for every user, they can then automatically create new subpages under their user page-

hmm, sorry, I still dont get it. Even if I create seperate userfolders in the Starterkit, each new page gets created in content (when parent: ist not defined) or in the folder “photography” as defined in the album section blueprint parent: kirby.page("photography"). I will have a fresh look tomorrow, thanks!

When a parent is not defined, a subpage is created in the current page folder. Of course, you have to setup a blueprint for your different level

e.g. userpage.yml with a pages section for the subpages, and another blueprint for the subpages.
And then the userpage model would have the isReadable restrictions.

Halleluja, yes of course! Thank you, it works.