fix: Renamed some data keys.

This commit is contained in:
Spencer Brower
2026-07-19 11:26:04 -04:00
parent 6f6c0dddd1
commit ce0f662c92
4 changed files with 13 additions and 13 deletions
+1 -1
View File
@@ -6,6 +6,7 @@
`reload_site` proc, that just updates changed resources.
- [ ] Only publish referenced assets.
- [ ] Split `load_page` into frontmatter-parse + body-process phases so draft pages can skip the markdown pipeline entirely
- [ ] Use spall to find ways to reduce run time.
- [ ] mustache data keys for opengraph, etc.
- [ ] Author should be a struct adhering to https://schema.org/author
- [ ] Block attributes on code fences (`{ #ex-1 }`) — hello-world.md
@@ -40,7 +41,6 @@
- [ ] commands
- [ ] `build` alias of default
- [ ] `init` set up new project
- [ ] Use spall to find ways to reduce run time.
- [ ] warn/error when unknown key used in mustache.
- [ ] Import/export packages. Hugo, jekyll, WordPress, etc.
- [ ] Markdown
+2 -2
View File
@@ -5,10 +5,10 @@
{{&body}}
</header>
<ul>
{{#list_pages}} <li><a href="{{permalink}}">{{&title}}</a><span>{{#date_iso}}<time
{{#pages}} <li><a href="{{permalink}}">{{&title}}</a><span>{{#date_iso}}<time
datetime="{{date_iso}}">{{date_display}}</time>{{/date_iso}}</span>
</li>
{{/list_pages}}
{{/pages}}
</ul>
</main>
{{/content}}
+2 -2
View File
@@ -3,7 +3,7 @@
<main>
<h1>{{page_title}}</h1>
{{&body}}
{{#year_sections}}
{{#by_year}}
<section>
<h2>{{year}}</h2>
<ul>
@@ -13,7 +13,7 @@
{{/posts}}
</ul>
</section>
{{/year_sections}}
{{/by_year}}
</main>
{{/content}}
{{/base}}
+8 -8
View File
@@ -49,13 +49,13 @@ Page_Data :: struct {
Home_Data :: struct {
using base: Base_Data,
list_pages: [dynamic]Page_Context,
pages: [dynamic]Page_Context,
}
Section_Data :: struct {
using base: Base_Data,
page_title: string,
year_sections: [dynamic]Year_Section,
by_year: [dynamic]Year_Section,
}
build_page_context :: proc(page: Page) -> Page_Context {
@@ -339,7 +339,7 @@ render_home_html :: proc(
}
data.title = site.title
data.body = home.body_html
data.list_pages = list_pages
data.pages = list_pages
data.og_url = fmt.tprintf("%s/", site.base_url)
data.og_title = site.title
data.og_type = "website"
@@ -356,8 +356,8 @@ render_section :: proc(
partials: map[string]mustache.Template,
base: Base_Data,
) -> string {
year_sections := make([dynamic]Year_Section)
defer delete(year_sections)
by_year := make([dynamic]Year_Section)
defer delete(by_year)
current_year := ""
for page in site.pages {
if page.section != section || page._is_index {
@@ -365,10 +365,10 @@ render_section :: proc(
}
year := get_year(page.date)
if year != current_year {
append(&year_sections, Year_Section{year = year})
append(&by_year, Year_Section{year = year})
current_year = year
}
append(&year_sections[len(year_sections) - 1].posts, build_page_context(page))
append(&by_year[len(by_year) - 1].posts, build_page_context(page))
}
data := Section_Data {
@@ -384,7 +384,7 @@ render_section :: proc(
data.title = fmt.tprintf("%s | %s", capitalize(section), site.title)
data.og_title = capitalize(section)
}
data.year_sections = year_sections
data.by_year = by_year
data.og_url = fmt.tprintf("%s/%s/", site.base_url, section)
data.og_type = "website"
data.is_article = false