WIP: page titles

This commit is contained in:
Catalin Constantin Mititiuc 2025-05-19 21:47:30 -07:00
parent 2a3f7f1e9e
commit c8a1632902
4 changed files with 21 additions and 7 deletions

View File

@ -72,8 +72,6 @@ or
## todo
* page titles
* draft documents
* treesitter highlighting for moonscript
* penlight library

5
about.html Normal file
View File

@ -0,0 +1,5 @@
$some[[<p>$one and then $two</p> ]]
$if{ true, target = 'World' }[[ Hello $target! ]], [[ Hi $target! ]]
$each{ { thing = "bye" }, { thing = "hello" } }[[$thing]]

View File

@ -83,14 +83,25 @@ list_posts = (page, limit) ->
}
} for { meta: meta, source: source } in *posts[1, limit or #posts]]
cosmo = require "sitegen.cosmo"
html_renderer = require "sitegen.renderers.html"
html_renderer.cosmo_helpers.if = (args, has_block) => cosmo.cif args, has_block
html_renderer.cosmo_helpers.titleize = (slug) => html.build ->
titleize_slug(slug) if slug
sitegen.create =>
@site_title = "WebDevCat.me · Catalin Mititiuc"
@site_title = "WebDevCat.me"
@app_name = "stasis"
@version = "0.2.12"
@list_posts = list_posts
add "index.html"
add "blog.html", target: "posts/index", template: "blog"
add "index.html", title: "Catalin Mititiuc"
add "blog.html", title: "Posts", target: "posts/index", template: "blog"
add "about.html", some: {
{ one: "alpha", two: "beta" },
{ one: "A", two: "B" }
}, cif: cosmo.cif, math: math, x: 2
for path, target in pairs posts "docs"
id = extract_id path
@ -101,7 +112,7 @@ sitegen.create =>
is_a: "post"
publish_date: publish_date path
id: id
titleize: (slug) -> html.build -> titleize_slug(slug)
-- titleize: (slug) -> html.build -> titleize_slug(slug)
-- replace post markdown yaml headers with moonscript headers
filter "docs", (body) =>

View File

@ -3,7 +3,7 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>$site_title$if{"title"}[[ — $title]]</title>
<title>$site_title$if{title or id}[[ · $(title or titleize(id))]]</title>
<link
rel="stylesheet"
id="font-bitter-css"