Skip to content

Commit 2e68e5a

Browse files
committed
Added minimal example site.
1 parent 5fc87d5 commit 2e68e5a

File tree

5 files changed

+41
-12
lines changed

5 files changed

+41
-12
lines changed

examples/minimal/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/logs/
2+
/output/
3+
/temp/

examples/minimal/config.lua

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
return {
2+
title = "Minimal Example Website",
3+
baseUrl = "http://example.com/",
4+
}

examples/minimal/content/index.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{{
2+
page.date = "2020-02-02"
3+
}}
4+
5+
# Welcome to {{ site.title }}!
6+
7+
This is the only page on this website. How fun!

examples/minimal/layouts/page.html

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1">
6+
{{ generatorMeta() }}
7+
8+
<title>
9+
{{ echo(page.title ~= "" and page.title.." - " or "") *}}
10+
{{ echo(site.title) }}
11+
</title>
12+
13+
<link rel="canonical" href="{{ url(page.permalink) }}">
14+
</head>
15+
16+
<body>
17+
{{ page.content }}
18+
</body>
19+
</html>

src/app.lua2p

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -102,18 +102,16 @@ local function setup()
102102
if not isFile(path) then
103103
local title = getFilename(pathToSite)
104104

105-
local contents = formatTemplate(
106-
[=[
107-
<!DOCTYPE html>
108-
<html lang="{{ site.languageCode }}">
105+
local contents = !(unindent[=[
106+
<!DOCTYPE html>
107+
<html lang="{{ site.languageCode }}">
109108
<head>
110109
<meta charset="utf-8">
111-
112110
<meta name="viewport" content="width=device-width, initial-scale=1">
113111
{{ generatorMeta() }}
114112

115113
<title>
116-
{{ echo(page.title ~= "" and page.title.." -" or "") }}
114+
{{ echo(page.title ~= "" and page.title.." - " or "") *}}
117115
{{ echo(site.title) }}
118116
</title>
119117

@@ -123,12 +121,8 @@ local function setup()
123121
<body>
124122
{{ page.content }}
125123
</body>
126-
127-
</html>
128-
]=], {
129-
-- ...
130-
}
131-
)
124+
</html>
125+
]=])
132126

133127
local file, err = io.open(path, "wb")
134128
if not file then errorNoPos(err) end
@@ -1357,8 +1351,10 @@ local function buildWebsite()
13571351
local main_chunk, err = loadLuaFile("config.lua", scriptEnvironment)
13581352
if not main_chunk then errorNoPos(err) end
13591353

1354+
timestampPrintVerbose("--> config(start)")
13601355
local config = main_chunk()
13611356
lineAssertTable(config, nil, nil, "%s: The file must return a table.", maybeFullPath"config.lua")
1357+
timestampPrintVerbose("--> config(finish)")
13621358

13631359
local function get(kPath, default, assertFunc, ...)
13641360
local v = config

0 commit comments

Comments
 (0)