You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Calls the component partial with component-specific arguments
134
+
- Wraps output with `utilities/section.html` for section-level styling
135
+
- Passes **section arguments** to the wrapper (e.g., `id`, `background`, `width`, `justify`, `wrapper`, `fluid`, `theme`, `cover`, `overlay-mode`, `section-class`, `bg-class`)
136
+
137
+
**Important distinctions:**
138
+
139
+
-**Section arguments are NOT part of the component partial** - they're handled by the section wrapper
140
+
-**Structure files should only include component-specific arguments** - arguments actively used by the partial
141
+
-**Section arguments are defined in Bookshop specs** (`.hugo.html` and `.bookshop.yml`) but not in the component's structure file
142
+
- Example: `preview.yml` defines `url`, `device`, `heading` (used by `preview.html`), but NOT `background`, `width`, etc. (only used by section wrapper)
**Design Goal:** Hinode v2 is a minimal core theme that works standalone for documentation and blog sites. Optional features are provided through separate modules.
Renders a live URL preview with switchable device views.
290
+
arguments:
291
+
url:
292
+
optional: false
293
+
release: v1.0.0
294
+
device:
295
+
optional: true
296
+
release: v1.0.0
297
+
heading:
298
+
optional: true
299
+
release: v1.0.0
300
+
old-param:
301
+
optional: true
302
+
deprecated: v1.1.0
303
+
alternative: device
304
+
```
305
+
306
+
```yaml
307
+
# Global argument definitions (mod-utils/data/structures/_arguments.yml)
308
+
arguments:
309
+
url:
310
+
type: string
311
+
comment: >-
312
+
Address of the link destination, either a local reference or an external
313
+
address. Include the `scheme` when referencing an external address.
314
+
device:
315
+
type: select
316
+
default: desktop
317
+
comment: >-
318
+
Device view to display by default in preview component. Determines the
319
+
initial iframe dimensions and active tab.
320
+
options:
321
+
values:
322
+
- desktop
323
+
- tablet
324
+
- mobile
325
+
heading:
326
+
type: heading
327
+
comment: >-
328
+
Heading of the content block, including a preheading and content element.
329
+
```
330
+
331
+
**When to add to _arguments.yml:**
332
+
333
+
- New argument used by multiple components - add full type definition to global file
334
+
- Component-specific argument - can define inline in structure file (but prefer global for reusability)
335
+
- Override default or add options - define inline in structure file (inherits base type from global)
336
+
337
+
**Common pitfall - Boolean argument handling:**
338
+
339
+
When accessing boolean arguments that could be explicitly set to `false`, **DO NOT use the
340
+
`or` operator** for fallback logic:
341
+
342
+
```hugo
343
+
{{/* WRONG - or operator treats false as falsy and skips it */}}
344
+
{{- $showPreview := or $args.showPreview $args.show_preview }}
345
+
346
+
{{/* CORRECT - directly access the camelCase version */}}
347
+
{{- $showPreview := $args.showPreview }}
348
+
```
349
+
350
+
The `or` operator returns the first truthy value, so `or false <fallback>` will skip
351
+
`false`and return the fallback instead of honoring the explicit `false` value.
352
+
353
+
**Best practices:**
354
+
355
+
- Always use `InitArgs` at the start of shortcodes and partials to validate arguments
356
+
- Define structure files in `data/structures/` for all shortcodes and components
357
+
- **Structure files should only reference arguments by name** - type definitions go in `_arguments.yml`
358
+
- **Only include arguments actively used by the component partial** - section arguments (like `id`, `background`, `width`, `justify`, `wrapper`, `fluid`, `theme`, `cover`, `overlay-mode`, `section-class`, `bg-class`) are handled by the Bookshop section wrapper and should NOT be in the component's structure file
359
+
- Add new argument types to `mod-utils/data/structures/_arguments.yml` for reuse across components
360
+
- Mark `deprecated`, `alternative`, and `release` in **component structure files** (component-specific metadata)
361
+
- Use hyphenated names for new arguments (e.g., `show-preview` not `show_preview`)
362
+
- Access arguments via their camelCase versions (e.g., `$args.showPreview`)
CSP headers are auto-generated via Hugo's segments feature. The theme includes `mod-csp` for Content Security Policy management. Headers are defined in `netlify.toml` and generated via `npm run build:headers`.
0 commit comments