SHOULDN'T YOU BE WRITING RIGHT NOW?

Content Management System

Kit55 provides a very simple Content Management System. It allows you to separate content from markup (HTML).

Imagine a blog site that has 2 pages. One of them with a list with the all the post's titles (home.html), and another page with the full post (post_detail.html).

Working with HTML, you have to repeat the titles in both, the post list page and the detail page.

For most use cases you can keep your text in the same place where you keep your HTML, that is, in your web page. But for some other use cases, you need to separate your content from it.

How does it work?

With Kit55 you create a file, context.json and keep it right below src. That file will contain your content, structured in json format. Just make sure that you name the file context.json and Kit55 will pick up all the data in it and will make it available to your pages.

For example, your context.json file could look like this:

{
  blog: [{
    title: "My first post",
    body: "If it's your job to eat a frog, it's best to do it first thing in the morning. And If it's your job to eat two frogs, it's best to eat the biggest one first."
  },
  {
    title: "My second post",
    body: "Whenever you find yourself on the side of the majority, it is time to pause and reflect."
  }]
}

This data is now available for you to use, so you can modify your home.html to loop through the titles:

...
{% for entry in blog %}
  <a href="{{entry.url}}">{{entry.title}}</a><br>
{% endfor %}
...

And you can reference the same data from your post detail page (post_detail.html):

...
  <a href="{{blog[0].url}}">{{blog[0].title}}</a><br>
  <span>{{blog[0].body}}</span>
...

You can find more information about the context dictionary object (context.json), variables and loop controls in the official Jinja documentation.

If you want to see how the Micro CMS works in a real example, download Kit55 Blog template.