diff --git a/website/content/navigation.nix b/website/content/navigation.nix
index 30303993..1410f617 100644
--- a/website/content/navigation.nix
+++ b/website/content/navigation.nix
@@ -6,6 +6,7 @@ in
menus.main = {
label = "Main";
items = [
+ { page = pages.index // { title = "Start"; }; }
{
menu.label = "For you";
menu.items = map (page: { inherit page; })
diff --git a/website/presentation/default.nix b/website/presentation/default.nix
index 38ca658a..9c78c0d1 100644
--- a/website/presentation/default.nix
+++ b/website/presentation/default.nix
@@ -5,6 +5,14 @@ let
types
;
templates = import ./templates.nix { inherit lib; };
+ render-html = document:
+ let
+ eval = lib.evalModules {
+ class = "DOM";
+ modules = [ document (import ./dom.nix { inherit lib; }).document ];
+ };
+ in
+ toString eval.config;
in
{
options.templates =
@@ -38,30 +46,38 @@ in
in
{
nav = lib.mkDefault templates.nav;
- page = lib.mkDefault (config: page: templates.html {
- head = ''
-
${page.title}
-
-
- '';
- body = ''
- ${config.menus.main.outputs.html page}
- ${builtins.readFile (commonmark page.name page.body)}
- '';
+ page = lib.mkDefault (config: page: render-html {
+ html = {
+ head = {
+ title.text = page.title;
+ meta.description = page.description;
+ link.canonical = lib.head page.locations;
+ };
+ body.content = ''
+ ${config.menus.main.outputs.html page}
+
+ ${page.title}
+
+ ${builtins.readFile (commonmark page.name page.body)}
+ '';
+ };
});
- article = lib.mkDefault (config: page: templates.html {
- head = ''
- ${page.title}
-
- ${with lib; join "\n" (map
- (author: '''')
- (if isList page.author then page.author else [page.author]))
- }
- '';
- body = ''
- ${config.menus.main.outputs.html page}
- ${builtins.readFile (commonmark page.name page.body)}
- '';
+ article = lib.mkDefault (config: page: render-html {
+ html = {
+ head = {
+ title.text = page.title;
+ meta.description = page.description;
+ meta.authors = if lib.isList page.author then page.author else [ page.author ];
+ link.canonical = lib.head page.locations;
+ };
+ body.content = ''
+ ${config.menus.main.outputs.html page}
+
+ ${page.title}
+
+ ${builtins.readFile (commonmark page.name page.body)}
+ '';
+ };
});
};
diff --git a/website/presentation/templates.nix b/website/presentation/templates.nix
index d33630b1..c0d7f652 100644
--- a/website/presentation/templates.nix
+++ b/website/presentation/templates.nix
@@ -1,19 +1,5 @@
{ lib }:
rec {
- html = { head, body }: ''
-
-
-
-
-
-
- ${lib.indent " " head}
-
-
- ${lib.indent " " body}
-
-
- '';
nav = menu: page:
let
render-item = item:
diff --git a/website/structure/document.nix b/website/structure/document.nix
index eca89c88..8af04c36 100644
--- a/website/structure/document.nix
+++ b/website/structure/document.nix
@@ -46,6 +46,8 @@ in
default = target: with lib; "${relativePath (head config.locations) (head target.locations)}.html";
};
outputs = mkOption {
+ # TODO: figure out how to make this overridable at any granularity.
+ # it should be possible with the DOM module now.
description = ''
Representations of the document in different formats
'';