From 5b04f9e0ae32be305b19a2e5e8b23bc1e3f2fb08 Mon Sep 17 00:00:00 2001 From: DarkWiiPlayer Date: Sat, 26 Mar 2022 09:09:13 +0100 Subject: [PATCH] Switch head and body content around in template --- pages/index.skooma.yue | 6 ++++-- templates/main.skooma.yue | 7 ++++--- templates/post.skooma.yue | 21 ++++++++++----------- 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/pages/index.skooma.yue b/pages/index.skooma.yue index 9daa59e..79108ee 100644 --- a/pages/index.skooma.yue +++ b/pages/index.skooma.yue @@ -3,7 +3,9 @@ import output from require 'params' link = => a @title, href: "/"..output..@uri -(json) => (ul [li link post.head, prefix for post in *@]), { +(json) => { title "Index" script "window.posts = JSON.parse(`#{json}`)" -} +}, ( + ul [li link post.head, prefix for post in *@]) +) diff --git a/templates/main.skooma.yue b/templates/main.skooma.yue index b37301a..56a93e9 100644 --- a/templates/main.skooma.yue +++ b/templates/main.skooma.yue @@ -1,8 +1,9 @@ import output from require 'params' (...) => - content, head_content = @(...) - return render.html(html { + head_content, body_content = @(...) + body_content = head_content unless body_content + render.html(html { lang: "english" head { link rel: "stylesheet", href: "/#{output}/css/site.css" @@ -10,6 +11,6 @@ import output from require 'params' head_content } body { - content + body_content } }) diff --git a/templates/post.skooma.yue b/templates/post.skooma.yue index 22fe010..cac9f3e 100644 --- a/templates/post.skooma.yue +++ b/templates/post.skooma.yue @@ -2,16 +2,15 @@ import output from require 'params' url = (path) -> "/"..output..path -(attributes) => - { - nav { - ul { - li a "Index", href: url "/" - [li a post.head.title, href: url post.head.uri for post in *require("posts")] - } +(attributes) => { + title attributes.title + link rel: "stylesheet", href: "/#{output}/css/post.css" +}, { + nav { + ul { + li a "Index", href: url "/" + [li a post.head.title, href: url post.head.uri for post in *require("posts")] } - article { h1(attributes.title), @ } - }, { - title attributes.title - link rel: "stylesheet", href: "/#{output}/css/post.css" } + article { h1(attributes.title), @ } +}