···4040The `makko.json` file will look something like this by default:
4141```json
4242{
4343- "title": "My Makko blog!",
4444- "url": "https://yourweb.site",
4545- "description": "My very own blog made with Makko!",
4646- "paths": {
4747- "symlinks_enabled": false,
4848- "source": "blog/",
4949- "output": "web/",
5050- "templates": "templates/"
5151- },
5252- "feeds": {
5353- "html": "index.html",
5454- "rss": "feed.rss",
5555- "atom": "feed.atom"
5656- },
5757- "custom": {
5858- "hey1": "You can add anything here, then reference it in your templates",
5959- "hey2": "or markdown files like this: {{custom.hey1}}, {{custom.hey2}}",
6060- "note": "Any JSON input through STDIN will be overlaid on top of this."
6161- },
6262- "callbacks": {
6363- "on_change": null,
6464- "on_create": null,
6565- "on_delete": null,
6666- "on_modify": null
6767- },
4343+ "title": "My Makko blog!",
4444+ "url": "https://yourweb.site",
4545+ "description": "My very own blog made with Makko!",
4646+ "paths": {
4747+ "symlinks_enabled": false,
4848+ "source": "blog/",
4949+ "output": "web/",
5050+ "templates": "templates/"
5151+ },
5252+ "feeds": {
5353+ "html": "index.html",
5454+ "rss": "feed.rss",
5555+ "atom": "feed.atom"
5656+ },
5757+ "custom": {
5858+ "hey1": "You can add anything here, then reference it in your templates",
5959+ "hey2": "or markdown files like this: {{custom.hey1}}, {{custom.hey2}}",
6060+ "note": "Any JSON input through STDIN will be overlaid on top of this."
6161+ },
6262+ "callbacks": {
6363+ "on_change": null,
6464+ "on_create": null,
6565+ "on_delete": null,
6666+ "on_modify": null
6767+ },
6868}
6969```
7070···7676`makko.json`
7777```json
7878{
7979- "title": "the best blog to have ever existed.",
8080- "url": "https://thebest.blog",
8181- "description": "that's right!"
8282- ...
7979+ "title": "the best blog to have ever existed.",
8080+ "url": "https://thebest.blog",
8181+ "description": "that's right!"
8282+ ...
8383```
84848585`templates/feed.html`
8686```html
8787-<!doctype html>
8888-<html lang="en">
8989- <head>
9090- <title>{{website.title}}</title>
9191- </head>
9292- <body>
9393- <h1>{{website.title}}</h1>
9494- <p1 style="opacity: 60%">{{website.description}}</p1>
9595- ...
9696- </body>
9797-</html>
8787+<head>
8888+ <title>{{website.title}}</title>
8989+</head>
9090+<body>
9191+ <h1>{{website.title}}</h1>
9292+ <p1 style="opacity: 60%">{{website.description}}</p1>
9393+ ...
9494+</body>
9895```
999610097You get:
···114111115112To better understand how to use templates in Makko, it is recommended you take a look at the [official Mustache tutorial](https://mustache.github.io/mustache.5.html). We also recommend looking at the [Template data reference](#template-data-reference) to see all the `{{different.data}}` you can use.
116113117117-> **Note:** You actually do not require `url` to be valid if you're only targetting HTML, It is mostly used for Atom and RSS data as they need a way to point users to individual posts in your website. (see the `feeds` section below)
114114+> **Note:** You actually do not require `url`, `title` or `description` to be valid if you're only targetting HTML, It is mostly used for Atom and RSS as they serve as useful metadata. (see the `feeds` section below)
118115119116120117## `paths`
···139136- `rss`: An RSS feed, which allows people to "subscribe" to your website and be up-to-date with new posts as long as they have a RSS reader.
140137- `atom`: Similar to RSS but more modern and better defined.
141138142142-To disable any of these, you can set its output path to `null`
139139+To disable any of these, you can set their output path to `null`.
143140144141145142## `custom`
···147144148145```json
149146"custom": {
150150- "about_me": {
151151- "name": "Neil D. Foster",
152152- "age": 20
153153- },
154154-155155- "awesomeness": 100,
156156- "love": "❤️"
147147+ "about_me": {
148148+ "name": "Neil D. Foster",
149149+ "age": 20
150150+ },
151151+152152+ "awesomeness": 100,
153153+ "love": "❤️"
157154}
158155```
159156160157`my_post.md`
161158```markdown
162159{{#custom.about_me}}
163163- I'm {{name}}!
164164- I'm exactly {{age}} years old!
160160+ I'm {{name}}!
161161+ I'm exactly {{age}} years old!
165162{{/custom.about_me}}
166163167164The awesomeness rate today is {{custom.awesomeness}}!
···182179`overlay.json`
183180```json
184181{
185185- "about_me": {
186186- "name": "Comet Startling",
187187- }
188188- "love": "💥"
182182+ "about_me": {
183183+ "name": "Comet Startling",
184184+ }
185185+ "love": "💥"
189186}
190187```
191188···213210214211```json
215212[
216216- {
217217- "status": "created",
218218- "id": "WHATEVER000",
219219-220220- "source": "cakepie.md",
221221- "url": "cakepie.html",
222222-223223- "title": "wow i love cake and pie!",
224224- "description": "here's how to make a cake that is also a pie, yeah!",
225225- "author": "cake pie lover."
226226- },
227227-228228- {
229229- "status": "modified",
230230- "id": "SUPERCOOL123",
231231-232232- "source": "supercool.md",
233233- "url": "supercool.html",
213213+ {
214214+ "status": "created",
215215+ "id": "WHATEVER000",
216216+217217+ "source": "cakepie.md",
218218+ "url": "cakepie.html",
219219+220220+ "title": "wow i love cake and pie!",
221221+ "description": "here's how to make a cake that is also a pie, yeah!",
222222+ "author": "cake pie lover."
223223+ },
234224235235- "title": "i think superman is supercool",
236236- "description": "i cried with the new movie.... i cried....",
237237- "author": "super man lover."
238238- },
239239-240240- {
241241- "status": "deleted",
242242- "id": "EMBARRASINGPOST985",
225225+ {
226226+ "status": "modified",
227227+ "id": "SUPERCOOL123",
228228+229229+ "source": "supercool.md",
230230+ "url": "supercool.html",
231231+232232+ "title": "i think superman is supercool",
233233+ "description": "i cried with the new movie.... i cried....",
234234+ "author": "super man lover."
235235+ },
243236244244- "source": "jermakiss.md",
245245- "url": "jermakiss.html"
246246- },
247247- ...
237237+ {
238238+ "status": "deleted",
239239+ "id": "EMBARRASINGPOST985",
240240+241241+ "source": "jermakiss.md",
242242+ "url": "jermakiss.html"
243243+ },
244244+ ...
248245```
249246250247The command runs from your project's root directory (where your `makko.json` file is), making that the Current Working Directory. Here's an example in Lua, with the `on_change` property set to `lua ./on_change.lua`:
···310307```json
311308// As per makko.json
312309"website": {
313313- "title": "My Makko Blog",
314314- "description": "Awesome dude type stuff",
315315- "url": "https://superaweso.me/blog/",
316316-317317- "feeds": {
318318- "html": "index.html",
319319- "rss": null,
320320- "atom": "feed.atom"
321321- }
310310+ "title": "My Makko Blog",
311311+ "description": "Awesome dude type stuff",
312312+ "url": "https://superaweso.me/blog/",
313313+314314+ "feeds": {
315315+ "html": "index.html",
316316+ "rss": null,
317317+ "atom": "feed.atom"
318318+ }
322319},
323323-320320+324321// As per makko.json and <stdin>
325322"custom": {},
326326-323323+327324// Only valid in "post.html"
328325"post": {
329329- "id": 123456789,
330330- "is_secret": false,
331331-332332- "title": "My awesome post",
333333- "description": "Dude It's SO awesome. ZOMG",
334334- "author": "InvaderZimRocks",
335335-336336- "tags": ["awesome", "super-cool", "dope-post"],
337337-338338- "source": "AWESOME.md",
339339- "url": "/AWESOME.html",
340340-341341- "created": {
342342- "raw": 123456789, // Milliseconds after unix epoch
343343-344344- "year": 2005,
345345- "month": "06"
346346- "day": "04",
347347-348348- "hour": "19",
349349- "minute": "46",
350350- "second": "34"
351351- },
352352-353353- // Same format as "created"
354354- "updated": { ,., },
355355-356356- // Null on anything but "post.html"
357357- "body": "<h1>ZOMG XD</h1> ..."
326326+ "id": 123456789,
327327+ "is_secret": false,
328328+329329+ "title": "My awesome post",
330330+ "description": "Dude It's SO awesome. ZOMG",
331331+ "author": "InvaderZimRocks",
332332+333333+ "tags": ["awesome", "super-cool", "dope-post"],
334334+335335+ "source": "AWESOME.md",
336336+ "url": "/AWESOME.html",
337337+338338+ "created": {
339339+ "raw": 123456789, // Milliseconds after unix epoch
340340+341341+ "year": 2005,
342342+ "month": "06"
343343+ "day": "04",
344344+345345+ "hour": "19",
346346+ "minute": "46",
347347+ "second": "34"
348348+ },
349349+350350+ // Same format as "created"
351351+ "updated": { ,., },
352352+353353+ // Null on anything but "post.html"
354354+ "body": "<h1>ZOMG XD</h1> ..."
358355}
359359-356356+360357// List of all posts, same format as "post" field.
361358// Only valid in "feed.html".
362359"posts": [...],
363363-360360+364361// Lists of tags, containing all posts with said tag
365362// "posts" is a list of posts with the same format as the "post" field.
366363// Only valid in "feed.html".
367364"tags": [
368368- {
369369- "name": "awesome",
370370- "posts": [...]
371371- },
372372- {
373373- "name": "super-cool",
374374- "posts": [...]
375375- },
376376- {
377377- "name": "dope-post",
378378- "posts": [...]
379379- },
365365+ { "name": "awesome", "posts": [...] },
366366+ { "name": "super-cool", "posts": [...] },
367367+ { "name": "dope-post", "posts": [...] },
380368]
381381-369369+382370// Lists of posts with X tag, same format as "post" field.
383371// Only valid in "feed.html".
384372"by_tag": {
385385- "awesome": [...],
386386- "super-cool": [...],
387387- "dope-post": [...],
388388- ...
373373+ "awesome": [...],
374374+ "super-cool": [...],
375375+ "dope-post": [...],
376376+ ...
389377}
390378```
391379···438426439427440428<h1 id="makko-migration">Migrating from makko 1.x to makko 2+</h1>
441441-442429The easiest way to migrate is to let `makko` re-generate a new `makko.json` instead of doing changes manually.
443430444431To do so, move/rename your `makko.json` to something like `makko.json.bak` and run `makko .` in your directory again.
···449436450437451438## Migrating Makko 1.x templates
452452-453439For Makko to continue working, you must adjust your templates slightly.
454440455441in your `templates/post.html`, you must surround any usage of the `body`, `description`, `author` and other post-attributes with a `{{#post}}` and `{{/post}}` like so: