refactor: $content, and &body renamed to $main and &content.

This commit is contained in:
Spencer Brower
2026-07-24 12:53:47 -04:00
parent 75a7d7a14b
commit 033e7f4f79
8 changed files with 18 additions and 17 deletions
+1
View File
@@ -45,6 +45,7 @@
- [ ] Integrity hash
- Allows users to verify their output didn't change after upgrading to a new version
- [ ] Content-hash fingerprinting for CSS and JS cache busting
- [ ] try to combine render_page_html and render_home_html?
- [ ] Avoid `json.Value` / `json.Object` where possible.
- [ ] Create a json schema file for `thor.json`.
- [ ] make `parse` an overload of `parse_text/parse_inline` and `parse_file`, or something.
+1 -1
View File
@@ -6,7 +6,7 @@
</head>
<body>
{{$nav}}{{/nav}}
{{$content}}{{/content}}
{{$main}}{{/main}}
{{$sidebar}}{{/sidebar}}
{{$footer}}{{/footer}}
</body>
+2 -2
View File
@@ -12,7 +12,7 @@
</ul>
</nav>
{{/nav}}
{{$content}}
{{$main}}
<main>
<h1>Archive</h1>
{{#posts | group_by year}}
@@ -26,7 +26,7 @@
</section>
{{/posts}}
</main>
{{/content}}
{{/main}}
{{$sidebar}}
<aside>
<h3>Recent Comments</h3>
+1 -1
View File
@@ -10,7 +10,7 @@
</head>
<body>
{{> nav}}{{$content}}{{/content}}
{{> nav}}{{$main}}{{/main}}
{{> footer}}
</body>
+3 -3
View File
@@ -1,8 +1,8 @@
{{<base}}
{{$content}}
{{$main}}
<main>
<header>
{{&body}}
{{&content}}
</header>
<ul>
{{#pages}} <li><a href="{{permalink}}">{{&title}}</a><span>{{#date_iso}}<time
@@ -11,5 +11,5 @@
{{/pages}}
</ul>
</main>
{{/content}}
{{/main}}
{{/base}}
+3 -3
View File
@@ -1,11 +1,11 @@
{{<base}}
{{$content}}
{{$main}}
<main>
<article>
<h1>{{page_title}}</h1>
{{#date_iso}} <time class="subtitle" datetime="{{date_iso}}">{{date_display}}</time>
{{/date_iso}} {{&body}}
{{/date_iso}} {{&content}}
</article>
</main>
{{/content}}
{{/main}}
{{/base}}
+3 -3
View File
@@ -1,8 +1,8 @@
{{<base}}
{{$content}}
{{$main}}
<main>
<h1>{{page_title}}</h1>
{{&body}}
{{&content}}
{{#posts | group_by year}}
<section>
<h2>{{key}}</h2>
@@ -15,5 +15,5 @@
</section>
{{/posts}}
</main>
{{/content}}
{{/main}}
{{/base}}
+4 -4
View File
@@ -21,7 +21,7 @@ Page_Context :: struct {
Base_Data :: struct {
now: string,
params: json.Value,
body: string,
content: string,
title: string,
description: string,
og: Open_Graph,
@@ -279,7 +279,7 @@ render_page_html :: proc(
}
data.title = fmt.tprintf("%s | %s", page.title, site.title)
data.page_title = page.title
data.body = page.body_html
data.content = page.body_html
data.date = page.date
data.og = og_for_page(site.og, page)
return render_template(content_tpl, data, partials)
@@ -305,7 +305,7 @@ render_home_html :: proc(
base = base,
}
data.title = site.title
data.body = home.body_html
data.content = home.body_html
data.pages = list_pages
data.og = og_for_page(site.og, home)
return render_template(content_tpl, data, partials)
@@ -333,7 +333,7 @@ render_section :: proc(
base = base,
}
if has_index {
data.body = section_index.body_html
data.content = section_index.body_html
data.page_title = section_index.title
data.title = fmt.tprintf("%s | %s", section_index.title, site.title)
data.og = og_for_page(site.og, section_index)