WIP: templates
This commit is contained in:
parent
b0e3dbcdcf
commit
2f94fd51ae
2
index.md
2
index.md
@ -4,6 +4,4 @@
|
||||
|
||||
## Posts
|
||||
|
||||
$render{"test"}
|
||||
|
||||
- [recursive]($root/posts/2023-08-03-recursively-list-all-files-in-a-directory-with-elixir.html)
|
||||
|
23
site.moon
23
site.moon
@ -1,7 +1,7 @@
|
||||
sitegen = require "sitegen"
|
||||
lfs = require "lfs"
|
||||
tools = require "sitegen.tools"
|
||||
site = require "sitegen.site"
|
||||
lfs = require "lfs"
|
||||
|
||||
rootname = (str) ->
|
||||
result = string.gsub str, "%..+", ""
|
||||
@ -18,22 +18,9 @@ posts = (path=".") ->
|
||||
files = [file for file in lfs.dir path when file != "." and file != ".."]
|
||||
{join(path, file), target(file, "/posts") for _, file in ipairs files}
|
||||
|
||||
-- renderer = require "sitegen.renderers.html"
|
||||
|
||||
|
||||
-- Change output dir to what Openresty prefers
|
||||
-- site = site!
|
||||
-- site.config.out_dir = "html/"
|
||||
|
||||
-- oof = site!
|
||||
|
||||
-- templates = site.templates
|
||||
|
||||
-- require"moon".p [k for k,v in pairs templates]
|
||||
-- require"moon".p [k for k,v in pairs site.templates]
|
||||
-- require"moon".p templates
|
||||
-- require"moon".p renderer.Renderer.can_load("test.md")
|
||||
-- require"moon".p renderer\helpers!
|
||||
site = site!
|
||||
site.config.out_dir = "html/"
|
||||
|
||||
css = tools.system_command "cat < %s > %s", "css"
|
||||
|
||||
@ -41,8 +28,8 @@ sitegen.create =>
|
||||
@title = "Hello World"
|
||||
@app_name = "stasis"
|
||||
@version = "0.2.12"
|
||||
add "index.md"
|
||||
add path, target: target for path, target in pairs posts "docs"
|
||||
|
||||
add "index.md"
|
||||
add path, target: out, template: "blog" for path, out in pairs posts "docs"
|
||||
|
||||
build css, "app.css"
|
||||
|
11
templates/blog.html
Normal file
11
templates/blog.html
Normal file
@ -0,0 +1,11 @@
|
||||
$render{"templates/root"}
|
||||
|
||||
<section>
|
||||
<h2><a href="$root/posts/">Web Log</a></h2>
|
||||
<p>Elixir, JavaScript, SVG, Containers, Git, Linux</p>
|
||||
<p>
|
||||
Questions, comments, feedback? <a href="mailto:webdevcat@proton.me">Contact the author</a>.
|
||||
</p>
|
||||
</section>
|
||||
|
||||
$body
|
@ -1,3 +1,5 @@
|
||||
$render{"templates/root"}
|
||||
|
||||
<main>
|
||||
$body
|
||||
</main>
|
||||
|
Loading…
x
Reference in New Issue
Block a user