Crates.io | siter |
lib.rs | siter |
version | 0.1.1 |
source | src |
created_at | 2020-09-08 14:32:35.832941 |
updated_at | 2021-12-03 09:24:37.194859 |
description | A static site generator where even content and config are templates |
homepage | |
repository | https://github.com/storyfeet/siter |
max_upload_size | |
id | 286153 |
size | 48,118 |
A static website generator, where every content item is a template and so are the templates.
The advantage of making content pages also templates is that you can sneak javascript into them for little bits and pieces, or loops without having to reorganise everything to fit them.
The setup for a basic website looks something like this.
any static files
root_config.ito
{{export
output="public"
}}
{{@export menu}}
<a href="/">HOME</a>
<a href="/apples">apples</a>
{{/export}}
index.md
{{export
title="My Website"
}}{{@md}}
Markdown
=======
By limiting markdown to specifig blocks we can include other kinds of content outside
{{/md}}
<script>
function not_markdown(){
return "This function will not be gobbled up by markdown"
}
</script>
{{@md}}
Realisitically most content pages won't need javascript, but it's nice to know you CAN.
{{/md}}
templates/page.html
{{export as_index=true}}
<doctype! HTML>
<html>
<head>
<title>{{first .title "My Default Title"}}</title>
{{#If the page has any head data include that here#}}
{{first .head}}
</head>
<body>
<div id="menu">{{.menu}}</div>
<div id="content">
{{$1}}{{# $1 is the page content #}}
</div>
</body>
</html>