How to specify site-wide params in config.json

Hi,

I’m using config.json instead of the config.toml or config.yaml. I don’t see an example of the config.json in the docs here however I was able to setup my basic config.json and specify things like baseurl, theme etc like so.

{
    "title": "thesite",
    "contentdir": "content",
    "theme": "justshipit",
    "layoutdir": "layouts",
    "publishdir": "public",
    "builddrafts": false,
    "MetaDataFormat": "json",
    "taxonomies": {
       "category": "categories",
       "tag": "tags"
    },
    "baseurl": "/",
}

Question is, how do I specify the site-wide params as json in my config.json ?

For YAML, the docs shows something like the following.

Is params just a json array, or an object?

Don’t mean to be talking to myself, but I figure it out. It looks like params is a json object (not array).

Something like the following works.

"params": {
    "twitterHandle": "thehandle",
    "defaultAuthor": "the author",
    "keywords": "keywords list here",
    "description": "site description here",
}

Curious: Why do you prefer JSON for configuration?

Hi @bep

I want to use json as the front-matter and for everything else, since I am most familiar with json and also plan on building an admin UI in asp.net to auto-generate some of the posts.

Is it possible to keep configs in toml or yaml and have the rest of the content stuff in json? Is that something you would recommend?

You can definitely do more than one. I use toml for my config and yaml for front matter - reason being that the latter is more universal for individual content files.

1 Like

Thanks @rdwatters

Yeah I can see that, considering (and I just learned this today, just now) that TOML expands out to Tom’s Obvious, Minimal Language. Who does that? i.e. name a markup after themselves? For that alone, I won’t be using TOML in my front-matter or markup :smiley:

…and he has trashed the world’s most popular object notation here.

I think it’s just a matter of taste. All serialized data is good in my book. As far as initialisms are concerned, YAML stands for “yaml ain’t markup language,” which is even cheesier than TOML…and a recursive “bacronym.” :slight_smile:

1 Like