Add Kirby to a static HTML website


I am new to Kirby (and to flat file CMSs in general), but I am really interested.

I have simple a website (a static website) and now I want to add Kirby CMS to it.

The website is really simple (Content+Sidebar).

What I would also like to do is also a a section in the homepage for a blog and one for some events (basically a title and a date filed).

There is a tutorial that can explain me step by step how can I implement Kirby to a simple HTML website?

Thanks a lot

Welcome :slight_smile:

Generally, you split static html into PHP snippets and templates. So things like Your sites header becomes a snippet, your footer is another… basically anything that gets re-used across multiple pages. You then use Blueprints to tell Kirby what kind of data you want to collect and store.

I would read through the cookbook guide on creating a blog, which will explain most of the fundamentals. You can also download the Starter kit and pick that apart to see how things fit together.

It’s worth reading the template 101 as well.

Give it a go from there and come back with more specific questions when you get stuck. We love to help here :slight_smile:

Have fun.

I could think of another solution: You could get some JavaScript library to consume the API of Kirby 3 and fetch the relevant data. This way, you still have a static site, just HTML5, CSS3 and JS. This might make sense if you don’t want to introduce PHP as a dependency for your static site (like when your static site and Kirby 3 will be separated setups).

I’m unaware to provide more details because I didn’t use it myself yet.

@warg Sure, you can do that too. There is a plugin for generating static HTML, or you can use something like Gatsby or Jigsaw to generate HTML by running Kirby headless and setting up an API / JSON route to pipe the information out.

It’s useful if you want to use the awesomeness of Kirby to manage the content but you need to host somewhere only supports html.

1 Like

You could go the javascript route, but for one thing, that requires being able of consuming an API via Javascript and with authentication if you use the Kirby API or add your own API, plus it requires users to have Javascript enabled.

You can add Kirby in a subfolder of your current site, same as here: Only using Kirby as a Blog plugin to my existing site

Or you move your static content to Kirby.

It really depends on what you’re after. If your hosting supports Kirby’s requirements and you don’t need the rest to be static, I’d go for one of the last.

Thank you all for the answers :slight_smile:

I think I’ll go for the option split the html into different PHP snippets.