This theme is a single page website. For more flexibility it split each section of the main page into dedicated blocks.
A block define a single part of a page, that can be ordered or manipulated independently.
The index page is using the templates.block-page.full
special template that accept a special block
argument.
The block
argument accept a list of blocks.
Example of block page declaration
index = {
title = "Home";
path = "/index.html";
template = templates.block-page.full;
layout = templates.layout;
blocks = [
(template.blocks.banner data.main-banner)
(templates.block.team data.team)
];
};
Note
|
templates.block-page.full is applying the library processBlocks function to the list of blocks , merging the blocks data into a single data attribute set.
|
The library processBlocks
function expects a block attribute set to define:
-
content
: The block content as a string. -
extraJS
: List of javascript files to load when the block is used, optional. -
extraCSS
: List of CSS files to load when the block is used, optional.
Simple block
{
content = "Hello world!";
}
Block declaring resources
{
content = "Hello world!";
extraCSS = [ "/js/hello.js" ];
extraJS = [ "/css/hello.css" ];
}
Usually, blocks are generated by applying a template to a data set like done in the example site.
Note
|
Blocks are meant to be flexible. For custom needs it is possible to use a custom block format and merge them with a custom processBlocks function.
|