Skip to content
This repository has been archived by the owner on Aug 13, 2022. It is now read-only.

Latest commit

 

History

History
57 lines (43 loc) · 1.61 KB

documentation.adoc

File metadata and controls

57 lines (43 loc) · 1.61 KB

This theme is a single page website. For more flexibility it split each section of the main page into dedicated blocks.

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.

Anatomy of a block

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.