Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,8 @@ When `.hugo.html` components call Hugo partials, they pass a dict with kebab-cas
## Key Constraints

- **Bookshop live editing**: Components must access arguments directly (not through helper partials)
- **Dual parameter names**: Support both snake_case (CloudCannon) and kebab-case (Hugo) using `(or .snake_case (index . "kebab-case"))`
- **Dual parameter names**: Support both snake_case (CloudCannon) and kebab-case (Hugo) using `(or .snake_case (index . "kebab-case"))`. For arguments where `0` or `false` is a meaningful value (such as `heading_level`), test key presence instead: `(cond (isset . "snake_case") .snake_case (index . "kebab-case"))`
- **Heading injection contract**: `page/blocks.html` injects a heading level only into blocks whose component sidecar (`component-library/components/<name>/<name>.yml`) declares a `heading-level` argument. A component that renders a section title but omits that entry silently keeps rendering `<div>` titles instead of failing validation
- **Hugo version**: Requires Hugo Extended 0.147.6+
- **Conventional Commits**: All commits must follow the specification (enforced by commitlint + husky)
- **Semantic versioning**: Releases are automated via semantic-release on the `main` branch
Expand Down
1 change: 1 addition & 0 deletions component-library/components/about/about.bookshop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ blueprint:
arrangement:
width:
size:
heading_level:
background:
backdrop:
color:
Expand Down
3 changes: 2 additions & 1 deletion component-library/components/about/about.hugo.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@
{{ $ratio := index $settings "ratio" | default "auto" }}

{{/* Generate the hero */}}
{{ $raw := partial "assets/hero.html" (dict
{{ $raw := partial "assets/hero.html" (dict
"page" $page
"heading-level" (cond (isset . "heading_level") .heading_level (index . "heading-level"))
"heading" (merge (dict "arrangement" "above" "width" 8) .heading)
"illustration" (merge (dict "ratio" $ratio) .illustration)
"order" .order
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ blueprint:
arrangement:
width:
size:
heading_level:
background:
backdrop:
color:
Expand Down
18 changes: 10 additions & 8 deletions component-library/components/approach/approach.hugo.html
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,11 @@
{{ if $split }}
{{/* Split layout: heading left, elements stacked right (50-50 on md+). */}}
{{ $title := partial "assets/section-title.html" (dict
"page" $page
"heading" (merge (dict "size" 5) (or .heading dict))
"justify" .justify
"class" "text-start mb-0"
"page" $page
"heading-level" (cond (isset . "heading_level") .heading_level (index . "heading-level"))
"heading" (merge (dict "size" 5) (or .heading dict))
"justify" .justify
"class" "text-start mb-0"
) }}

{{ $items := "" }}
Expand Down Expand Up @@ -140,10 +141,11 @@
{{ end}}

{{- $raw = printf "%s%s" $raw (partial "assets/section-title.html" (dict
"page" $page
"heading" .heading
"justify" .justify
"class" (printf "pb-%d" $padding.y)))
"page" $page
"heading-level" (cond (isset . "heading_level") .heading_level (index . "heading-level"))
"heading" .heading
"justify" .justify
"class" (printf "pb-%d" $padding.y)))
-}}

{{/* Add featured illustration */}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ blueprint:
arrangement:
width:
size:
heading_level:
background:
backdrop:
color:
Expand Down
9 changes: 5 additions & 4 deletions component-library/components/articles/articles.hugo.html
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,11 @@
{{/* Main code */}}
{{ if or (gt (len $pages) 0) (not .hide_empty) }}
{{- $raw = printf "%s%s" $raw (partial "assets/section-title.html" (dict
"page" $page
"heading" .heading
"justify" .justify
"class" (printf "pb-%d" $padding.y)))
"page" $page
"heading-level" (cond (isset . "heading_level") .heading_level (index . "heading-level"))
"heading" .heading
"justify" .justify
"class" (printf "pb-%d" $padding.y)))
-}}

{{ $partial := "assets/card-group.html" }}
Expand Down
1 change: 1 addition & 0 deletions component-library/components/cards/cards.bookshop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ blueprint:
arrangement:
width:
size:
heading_level:
background:
backdrop:
color:
Expand Down
9 changes: 5 additions & 4 deletions component-library/components/cards/cards.hugo.html
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,11 @@

{{/* Main code */}}
{{- $raw = printf "%s%s" $raw (partial "assets/section-title.html" (dict
"page" $page
"heading" .heading
"justify" .justify
"class" (printf "pb-%d" $padding.y)))
"page" $page
"heading-level" (cond (isset . "heading_level") .heading_level (index . "heading-level"))
"heading" .heading
"justify" .justify
"class" (printf "pb-%d" $padding.y)))
-}}

{{/* Init base arguments for card group */}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ blueprint:
content:
align:
width:
heading_level:
background:
backdrop:
color:
Expand Down
12 changes: 7 additions & 5 deletions component-library/components/contact-form/contact-form.hugo.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,10 @@
{{ if .illustration }}
{{/* Embed the form in a horizontal hero with an illustration */}}
{{ $width := sub 12 (.illustration.width | default 6) }}
{{ $raw = partial "assets/hero.html" (dict
{{ $raw = partial "assets/hero.html" (dict
"page" $page
"raw" (printf `<div class="p-0 pt-%d"></div>%s` $padding.y $form)
"heading-level" (cond (isset . "heading_level") .heading_level (index . "heading-level"))
"heading" (merge .heading (dict "width" $width))
"illustration" (merge .illustration (dict "width" 12))
"order" .order
Expand All @@ -75,10 +76,11 @@
}}
{{ else }}
{{- $raw = partial "assets/section-title.html" (dict
"page" $page
"heading" .heading
"justify" .justify
"class" (printf "pb-%d" $padding.y))
"page" $page
"heading-level" (cond (isset . "heading_level") .heading_level (index . "heading-level"))
"heading" .heading
"justify" .justify
"class" (printf "pb-%d" $padding.y))
-}}
{{ $raw = printf "%s%s" $raw $form }}
{{ end }}
Expand Down
1 change: 1 addition & 0 deletions component-library/components/cta/cta.bookshop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ blueprint:
arrangement:
width:
size:
heading_level:
background:
backdrop:
color:
Expand Down
3 changes: 2 additions & 1 deletion component-library/components/cta/cta.hugo.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,10 @@
{{ end }}
{{ end }}

{{ $raw := partial "assets/contact.html" (dict
{{ $raw := partial "assets/contact.html" (dict
"page" $page
"orientation" "horizontal"
"heading-level" (cond (isset . "heading_level") .heading_level (index . "heading-level"))
"heading" .heading
"contact" .contact
"caption-url" (or .caption_url (index . "caption-url"))
Expand Down
1 change: 1 addition & 0 deletions component-library/components/faq/faq.bookshop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ blueprint:
arrangement:
width:
size:
heading_level:
background:
backdrop:
color:
Expand Down
9 changes: 5 additions & 4 deletions component-library/components/faq/faq.hugo.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,11 @@
{{ $color := "" }}
{{ if .contrast }}{{ $color = "white" }}{{ end }}
{{- $raw := partial "assets/section-title.html" (dict
"page" $page
"heading" .heading
"justify" .justify
"class" (printf "pb-%d" $padding.y))
"page" $page
"heading-level" (cond (isset . "heading_level") .heading_level (index . "heading-level"))
"heading" .heading
"justify" .justify
"class" (printf "pb-%d" $padding.y))
-}}

{{ $class := "" }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ blueprint:
arrangement:
width:
size:
heading_level:
background:
backdrop:
color:
Expand Down
3 changes: 2 additions & 1 deletion component-library/components/featured/featured.hugo.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@
{{ $page := or ._page page }}

{{ if not $error }}
{{ $raw := partial "assets/hero.html" (dict
{{ $raw := partial "assets/hero.html" (dict
"page" $page
"heading-level" (cond (isset . "heading_level") .heading_level (index . "heading-level"))
"heading" (merge (dict "width" 8) (or .heading dict))
"illustration" (merge (dict "ratio" "auto") (or .illustration dict))
"order" .order
Expand Down
1 change: 1 addition & 0 deletions component-library/components/heading/heading.bookshop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ blueprint:
arrangement:
width:
size:
heading_level:
background:
backdrop:
color:
Expand Down
7 changes: 4 additions & 3 deletions component-library/components/heading/heading.hugo.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,10 @@

{{/* Main code */}}
{{- $raw := partial "assets/section-title.html" (dict
"page" $page
"heading" .heading
"justify" .justify)
"page" $page
"heading-level" (cond (isset . "heading_level") .heading_level (index . "heading-level"))
"heading" .heading
"justify" .justify)
-}}

{{ if $raw }}
Expand Down
1 change: 1 addition & 0 deletions component-library/components/hero/hero.bookshop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ blueprint:
arrangement:
width: 8
size:
heading_level:
background:
backdrop:
color:
Expand Down
23 changes: 12 additions & 11 deletions component-library/components/hero/hero.hugo.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,18 @@

{{ if not $error }}
{{ $raw := partial "assets/hero.html" (dict
"page" $page
"breadcrumb" .breadcrumb
"heading" .heading
"illustration" .illustration
"align" .align
"order" .order
"link-type" (or .link_type (index . "link-type"))
"links" .links
"orientation" .orientation
"width" .width
"cover" .cover
"page" $page
"heading-level" (cond (isset . "heading_level") .heading_level (index . "heading-level"))
"breadcrumb" .breadcrumb
"heading" .heading
"illustration" .illustration
"align" .align
"order" .order
"link-type" (or .link_type (index . "link-type"))
"links" .links
"orientation" .orientation
"width" .width
"cover" .cover
)
}}

Expand Down
1 change: 1 addition & 0 deletions component-library/components/list/list.bookshop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ blueprint:
arrangement:
width:
size:
heading_level:
background:
backdrop:
color:
Expand Down
9 changes: 5 additions & 4 deletions component-library/components/list/list.hugo.html
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,11 @@
{{ $hideEmpty := or .hide_empty (index . "hide-empty") }}
{{ if or (gt (len $pages) 0) (not $hideEmpty) }}
{{- $raw := partial "assets/section-title.html" (dict
"page" $page
"heading" .heading
"justify" .justify
"class" (printf "pb-%d" $padding.y))
"page" $page
"heading-level" (cond (isset . "heading_level") .heading_level (index . "heading-level"))
"heading" .heading
"justify" .justify
"class" (printf "pb-%d" $padding.y))
-}}
{{ if gt (len $pages) 0 }}
{{ $content := "" }}
Expand Down
1 change: 1 addition & 0 deletions component-library/components/menu/menu.bookshop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ blueprint:
arrangement:
width:
size:
heading_level:
background:
backdrop:
color:
Expand Down
9 changes: 5 additions & 4 deletions component-library/components/menu/menu.hugo.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,11 @@

{{/* Main code */}}
{{- $raw := partial "assets/section-title.html" (dict
"page" $page
"heading" .heading
"justify" .justify
"class" (printf "pb-%d" $padding.y))
"page" $page
"heading-level" (cond (isset . "heading_level") .heading_level (index . "heading-level"))
"heading" .heading
"justify" .justify
"class" (printf "pb-%d" $padding.y))
-}}

{{- $raw = printf "%s%s" $raw (partial "assets/menu.html" (dict
Expand Down
1 change: 1 addition & 0 deletions component-library/components/panels/panels.bookshop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ blueprint:
arrangement:
width:
size:
heading_level:
background:
backdrop:
color:
Expand Down
9 changes: 5 additions & 4 deletions component-library/components/panels/panels.hugo.html
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,11 @@

{{/* Main code */}}
{{- $raw := partial "assets/section-title.html" (dict
"page" $page
"heading" .heading
"justify" .justify
"class" (printf "pb-%d" $padding.y))
"page" $page
"heading-level" (cond (isset . "heading_level") .heading_level (index . "heading-level"))
"heading" .heading
"justify" .justify
"class" (printf "pb-%d" $padding.y))
-}}

{{- $raw = printf "%s%s" $raw (partial "assets/nav.html" (dict
Expand Down
1 change: 1 addition & 0 deletions component-library/components/preview/preview.bookshop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ blueprint:
arrangement:
width:
size:
heading_level:
background:
backdrop:
color:
Expand Down
1 change: 1 addition & 0 deletions component-library/components/preview/preview.hugo.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
{{/* Main code */}}
{{ $raw := partial "assets/preview.html" (dict
"page" $page
"heading-level" (cond (isset . "heading_level") .heading_level (index . "heading-level"))
"url" .url
"device" .device
"controls-placement" (or .controls_placement (index . "controls-placement"))
Expand Down
1 change: 1 addition & 0 deletions component-library/components/team/team.bookshop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ blueprint:
arrangement:
width:
size:
heading_level:
background:
backdrop:
color:
Expand Down
9 changes: 5 additions & 4 deletions component-library/components/team/team.hugo.html
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,11 @@
{{ $hideEmpty := or .hide_empty (index . "hide-empty") }}
{{ if or (gt (len $pages) 0) (not $hideEmpty) }}
{{- $raw := partial "assets/section-title.html" (dict
"page" $page
"heading" .heading
"justify" .justify
"class" (printf "pb-%d" $padding.y))
"page" $page
"heading-level" (cond (isset . "heading_level") .heading_level (index . "heading-level"))
"heading" .heading
"justify" .justify
"class" (printf "pb-%d" $padding.y))
-}}

{{ $partial := "assets/card-group.html" }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ blueprint:
arrangement:
width:
size:
heading_level:
background:
backdrop:
color:
Expand Down
Loading