Recommended Content Structure?

Hi everyone! :wave: Kirby n00b here (and first time using PHP). I am SUPER excited to jump in and learn Kirby. Love the NoDB concept.

I run a small site called uxtools that’s currently mostly a VueJS single-page-app. I’m looking to move to Kirby for SEO purposes, and to get my blog off of Medium.

As you can see at https://uxtools.co/tools, I have a lot of JSON pumping through the app. I’d like to ideally generate pages for Kirby for each category and each individual tool.

I was imagining that I would structure my content like this, then:
Main
— Tools
— Prototyping
— Tool 1
— Tool 2
— …
— Design
— Tool 1
— Tool 2
— …
— Versioning
— Tool 1
— Tool 2
— …

That’s going to be a lot of data entry, however! I thought maybe I could generate JSON from those pages, and then use the JSON to power the VueJS app.

Is there a way to automatically generate pages from JSON, or am I looking at this completely wrong? I appreciate any feedback or direction!

If I get it right, these are two different questions.

  1. Can you read the current JSON and create folders and files from that in Kirby. Answer: yes, that is possible. Does the current content only exist in JSON format?

  2. Can you generate JSON from Kirby pages to be consumed in an app. Answer: yes, of course. There is even a plugin you can use to create your JSON API.

The structure looks ok, unless there are tools that belong to multiple categories.

  1. The content currently exists as JSON. Are there any tutorials for creating folders/files from JSON?
  2. Cool, that plugin looks great. Ideally, I would compile the JSON locally and import it into my Javascript, but I might be able to make something like this work.

Thanks for the help!

Do you have a link to something that would let me know where to start if I want to import a json file and turn it into individual Kirby pages?

You can read a son file like this:

$json = f::read($kirby->roots()->index().'/your-json-file.json');  // or whatever the path
dump(json_decode($json, true)); // with the true parameter, an array is returned, otherwise an standard PHP object

You can then loop through your array and create pages from it.

Guess I need to dig into the socks for the bits on creating page. Haven’t done that part before, and kind of forgot it was a thing I could do. Thanks!

Check out the docs, or this forum or my https://github.com/texnixe/kirby-csv-handler plugin

Ooh, that plugin looks perfect the needs of this specific project I think. Thanks!