Hi everyone! 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.
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?
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.
The content currently exists as JSON. Are there any tutorials for creating folders/files from JSON?
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.
$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.