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