diff --git a/README.md b/README.md
index 1ff03f0..7f8fe27 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,157 @@
# Teapot
because doll. it uses [markdoll](https://codeberg.org/0x57e11a/markdoll).
+
+## Usage
+
+this is a nix package/flakey thing, the package outputs a normal directory/derivation so awawa
+
+### step 1: make the nix package!
+
+basically, make a package that do this (there's like 8 ways to do this please be careful)
+
+```nix
+brewTea {
+ name = "doll site";
+ src = ./.;
+
+ layoutSrc = ./layouts;
+ defaultLayout = ./layouts/default.html;
+};
+```
+
+### step 2: make the default layout!
+
+here's a good `layouts/default.html` to start with..
+
+```html
+
+
+
+
+ %%TITLE%%:doll
+ %%HEAD%%
+
+
+
+ %%CONTENT%%
+
+
+```
+
+#### step 2a: what the %%%% do
+
+the layout engine knows three keywords:
+
+- `%%TITLE%%` which comes from either the filename (so `index.doll` -> `index`) or the frontmatter `title` key (what is a frontmatter? skip to **step 3a**)
+- `%%HEAD%%` which is filled in by the following frontmatter keys:
+ - `description` becomes a meta:description tag
+ - `tags` becomes a meta:keywords tag
+ - `author` becomes a meta:author tag
+- `%%CONTENT%%` becomes the markdoll content
+
+### step 3: make MARKDOLL!!!!!
+
+ok so lets just put something basic into `index.doll`
+
+```
+&hello everydolly!
+ awawawawawa
+
+ [img(https://codeberg.org/0x57e11a/markdoll/raw/branch/main/button.png)::
+ alt text goes here (88x31 button that says MADE WITH MARKDOLL)
+ ]
+```
+
+### step 3a: make FRONTMATTER!!
+
+(this is a weird word dw about it its actually some cool stuff)
+
+so we can add some details aboput every markdoll file,, lets add everything we support!!
+
+```
+---
+title: doll!!! points!
+description: dolldolldolldolldolldolldolldoll
+tags: no witches allowed, maybe if She brings tea tho
+author: aki.41666
+layout: default.html
+---
+&hello everydolly!
+ awawawawawa
+
+ [img(https://codeberg.org/0x57e11a/markdoll/raw/branch/main/button.png)::
+ alt text goes here (88x31 button that says MADE WITH MARKDOLL)
+ ]
+```
+
+its the stuff between the --- and --- thing
+
+is IS NOT YAML
+
+do NOT yaml this. it is `key: value` and value is a string
+
+no exceptions!!!!!!!!!
+
+### step 3b: make another layout
+
+so we can add more layouts to `layouts/` folder, maybe have one for the smart sysmate and one for the silly sysmate
+
+and switch between them using `layout` in frontmatter
+
+so together,
+
+`layouts/aki.html`
+
+```html
+
+
+
+
+ %%TITLE%%:doll/aki
+ %%HEAD%%
+
+
+
+
+ %%CONTENT%%
+
+
+```
+
+and then a simple `aki.doll`
+
+```
+---
+title: hi it is
+layout: aki.html
+---
+&its aki!!!!!!!!!
+ awawa
+```
+
+this will produce a different output containing 100% more aki
+
+### step 4: build it (n stuff)
+
+the easiest way to _just output stuff_ is
+
+```sh
+nix build . # if using flakes
+nix-build # if not
+nix-shell -p python3 --command "python -m http.server -d result" # to look at it
+```
+
+and open http://localhost:8000
diff --git a/examples/quickstart/default.nix b/examples/quickstart/default.nix
index f276344..61bb390 100644
--- a/examples/quickstart/default.nix
+++ b/examples/quickstart/default.nix
@@ -4,4 +4,7 @@
src = ./.;
layoutSrc = ./layouts;
+
+ # maybe don't do this but its possible to reference _any file_.
+ defaultLayout = ./layouts/default.html;
}
\ No newline at end of file
diff --git a/examples/quickstart/index.doll b/examples/quickstart/index.doll
index 85d4a5a..95ad0f4 100644
--- a/examples/quickstart/index.doll
+++ b/examples/quickstart/index.doll
@@ -1,6 +1,8 @@
---
title: awawa!
layout: alt.html
+description: this is teapot!!
+tags: teapot, markdoll
---
this is markdoll!
diff --git a/examples/quickstart/layouts/alt.html b/examples/quickstart/layouts/alt.html
index e5935ad..28aa3db 100644
--- a/examples/quickstart/layouts/alt.html
+++ b/examples/quickstart/layouts/alt.html
@@ -1,12 +1,17 @@
-%%TITLE%% | alt layout
-
-
-
- %%CONTENT%%
-
+
+
+ %%TITLE%% | alt layout
+ %%HEAD%%
+
+
+
+
+ %%CONTENT%%
+
+
diff --git a/examples/quickstart/layouts/default.html b/examples/quickstart/layouts/default.html
index 562e84a..da57641 100644
--- a/examples/quickstart/layouts/default.html
+++ b/examples/quickstart/layouts/default.html
@@ -1,6 +1,11 @@
-%%TITLE%% | default layout
-
-
- %%CONTENT%%
-
+
+
+ %%TITLE%% | default layout
+ %%HEAD%%
+
+
+
+ %%CONTENT%%
+
+
diff --git a/examples/quickstart/page2.doll b/examples/quickstart/page2.doll
index 14007d4..77e7563 100644
--- a/examples/quickstart/page2.doll
+++ b/examples/quickstart/page2.doll
@@ -1,5 +1,6 @@
---
title: AWAWAWA
+layout: default.html
---
&real awawa shit
diff --git a/pkgs/brewTea.nix b/pkgs/brewTea.nix
index 21f6268..654abf1 100644
--- a/pkgs/brewTea.nix
+++ b/pkgs/brewTea.nix
@@ -35,7 +35,7 @@ in pkgs.stdenvNoCC.mkDerivation {
key=$1
file=$2
- keyLine=$(grep -e "$key: " $file || echo "")
+ keyLine=$(grep -e "^$key: " $file || echo "")
sed "s/.*: //" <<<$keyLine | xargs
}
@@ -66,9 +66,25 @@ in pkgs.stdenvNoCC.mkDerivation {
title=$(basename $file | sed -e 's/.doll$//')
fi
+ ### Frontmatter: Meta Head Stuff
+ local head=""
+ local meta_description=$(get_frontmatter description $file)
+ if [ ! -z meta_description ]; then
+ head="$head"
+ fi
+ local meta_tags=$(get_frontmatter tags $file)
+ if [ ! -z meta_tags ]; then
+ head="$head"
+ fi
+ local meta_author=$(get_frontmatter author $file)
+ if [ ! -z meta_author ]; then
+ head="$head"
+ fi
+
### Layout: Title + Content
layout_inject $layoutPath %%TITLE%% <<<"$title" > $outFile.tmp.1
- layout_inject $outFile.tmp.1 %%CONTENT%% $content > $outFile.tmp.final
+ layout_inject $outFile.tmp.1 %%HEAD%% <<<"$head" > $outFile.tmp.2
+ layout_inject $outFile.tmp.2 %%CONTENT%% $content > $outFile.tmp.final
### Layout: Cleanup Tmpfiles
cp $outFile.tmp.final $outFile