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

How to add a new block?
How to add a new blog post?
How to display a list of links?
How to use dynamic data?
How to use Stapy on Windows?
How to host my static website for free?