eudicots / Cactus

Static site generator for designers. Uses Python and Django templates.
BSD 3-Clause "New" or "Revised" License
3.47k stars 314 forks source link

Is there a way to use global metadata in config.json? #125

Closed lightweightadventures closed 9 years ago

lightweightadventures commented 9 years ago

What I'd like to do/ am attempting to do is have some form of global metadata in the config.son file:

{
    "prettify": true,
    "blog": {
        "id": "fancy-site",
       "author": "Joe Blogs",
      "description": "Such a fancy site"
    }
}

And be able to use this in the templates and layouts:

<meta name="author" content="{{ blog.author }}">
<meta name="description" content="{{ blog.description }}">

<body id="{{ blog.id }}">

Is this currently possible within cactus? The above doesn't work -- how would I go approach implementing global metadata?

Thanks all...

krallin commented 9 years ago

Hi there,

Extra context should be included in the context key in the configuration:

{
    "prettify": true,
    "context": {
        "blog": {
            "id": "fancy-site",
            "author": "Joe Blogs",
            "description": "Such a fancy site"
         }
    }
}

This will be loaded by the builtin context plugin

lightweightadventures commented 9 years ago

Massive thanks Krallin.