diff --git a/demo/data.md b/demo/data.md new file mode 100644 index 0000000..1864a34 --- /dev/null +++ b/demo/data.md @@ -0,0 +1,33 @@ +--- +title: All about Data +layout: base.html +--- + +# All about Data + +## Data Cascade + +### Data provided by Sissi + +### The `_data` subdirectory + +### The Frontmatter + +## Using data inside templates + +Sissi supports a "poor girl's handlebars". It looks for expressions wrapped in double curly braces and replaces them with the data accordingly. If the data is resolved as a function, a parameterless function call will be invoked. If the data results a Promise, it is automatically resolved. + +If you place a javascript file named `meta.js` in your _data directory which provides a default export, you can access the object like this: + +```js +export default { + author: 'Lea' +}; +``` + +```html +{\{ meta.author }\} +``` + +Alternatively, you can put json or yaml into the data directory. + diff --git a/demo/templating.md b/demo/templating.md index 5ca38fe..58dadbc 100644 --- a/demo/templating.md +++ b/demo/templating.md @@ -16,15 +16,7 @@ You can include HTML via the html-include tag. It will fetch the partial HTML sn ## Template Data -Sissi supports a "poor girl's handlebars". It looks for expressions wrapped in double curly braces and replaces them with the data accordingly. If the data is resolved as a function, a parameterless function call will be invoked. If the data results a Promise, it is automatically resolved. - -If you place a javascript file named `meta.js` in your _data directory which provides a default export, you can access the object like this: - -```html -{{ meta.author }} -``` - -Alternatively, you can put json or yaml into the data directory. +Sissi supports a "poor girl's handlebars". It looks for expressions wrapped in double curly braces and replaces them with the data accordingly. More details on this is in the next section about data. ## Built-in filters