Stapy

Static Site Generator

How-to: How to add a new block?

How to add a new block?

Step 1

Open the HTML layout configuration file:

source
+--- layout
     +--- html.json

Add a new entry with the block template path:

{
    ...
    "banner": "template/block/banner.html"
    ...
}

Step 2

Create the new block template file with the HTML content:

source
+--- template
     +--- block
          +--- banner.html
<div id="banner>
    Welcome!
</div>

Step 3

Add the new block in the page template:

source
+--- template
     +--- default.html
<!-- ... -->
<main>
    {% banner %}
    <!-- ... -->
</main>
<!-- ... -->

Next