Create inital content structure from YAML file?

With larger web projects I often start building the content structure from a mind map or a plain text file. My process right now is to export a plain text file from MindNode clean it up a bit and run the following terminal command.

cat folders.txt | xargs mkdir

This creates all the folders and subfolders required with one command. However, what would be so nice to have is the ability to have something similar to a blueprint in which you could not only define the folder-structure but also the initial template and language requirements for the empty text files or even populate these with some initial data.

Simple, just the folders:

home
error
projects
  project-a
  project-b

Dreamcode for a more advanced use case:

languages:
  de
  en
folders:
  home:
    template: home
    title 
      de: Startseite
      en: Homepage
  error:
    template: error
  projects:
    template: projects
    children:
      project-a
      project-b
      project-c
  contact
  search:
    template: search

Maybe someone here in the forum has already created a solution with a more advanced terminal command or directly with Kirby/PHP? Thank you!

I don’t recall ever seeing a way to do it from blueprints, because thats not quite how they work. However, if you can get your data into CSV format, theres a plugin that will generate the pages for you.

1 Like

I haven’t seen such a script yet, but it wouldn’t be difficult to do:

$pageStructure = yaml(f::read(kirby()->roots()->index() . '/creator.txt'));

gives you a multi-dimensional array to work from. Then you can use Kirby’s API do create the page structure. Note that if you go down this route, you would have to first create the page in the default structure, then in the none-default languages (if you really need this).

1 Like

Thank you @texnixe & @jimbobrjames for the suggestions.

Don’t know, if Structurer App (Mac only) still works … my post is almost 3 years old, but maybe it helps …

Yes, the App is still working (High Sierra). Great little helper.
Thank you @flokosiol