Files
HugoBlox-kit/modules/slides/layouts/_partials/slides.html
T
George Cushen aa9edea5df feat(slides): add persistent branding with per-slide visibility control
- Add branding overlays: logo, title, author, and footer text
- Use Reveal.js theme CSS variables for automatic color adaptation
- Inline SVGs for currentColor support on any theme
- Per-slide control via HTML comments:
  - <!-- no-branding -->: hide all elements
  - <!-- no-header -->: hide logo + title
  - <!-- no-footer -->: hide author + footer
- Fix body-level CSS selectors for proper visibility
- Add comprehensive documentation in example slides
2026-01-13 15:36:32 +00:00

69 lines
2.4 KiB
HTML

<div class="reveal">
<div class="slides">
{{/* Loop over each page. */}}
{{ range . }}
{{ if ne (len .Content) 0 }}
{{/* Must remove `<hr />` generated by Blackfriday footnotes as conflicts with slide delimiter. */}}
{{/* Commented out workaround as Blackfriday has been superseded by Goldmark in Hugo 0.60. */}}
{{/* TODO: reintroduce a similar workaround if Goldmark requires it. */}}
{{/* $content := replace .Content "<div class=\"footnotes\">\n\n<hr />" "<div class=\"footnotes\">" */}}
{{ $content := .Content }}{{/* For Goldmark. */}}
{{/* Let `---` delimit slides. In Goldmark, that is `<hr>`. Alternatively, for Blackfriday, use `<hr />`. */}}
{{ range (split $content "<hr>") }}
{{/* Check if this slide should be hidden using inline comment */}}
{{ $isHidden := false }}
{{ $slideContent := . }}
{{ if in . "<!-- hide -->" }}
{{ $isHidden = true }}
{{/* Remove the hide comment from the content */}}
{{ $slideContent = replace . "<!-- hide -->" "" }}
{{ end }}
{{/* Each `<section>` defines a new slide. */}}
{{/* Only begin new slide `<section>` if not already added by custom `slide` shortcode. */}}
{{ if not (in . "data-noprocess") }}
{{/* Parse visibility comments */}}
{{ $state := slice }}
{{ if in . "<!-- no-branding -->" }}
{{ $state = $state | append "no-branding" }}
{{ end }}
{{ if in . "<!-- no-header -->" }}
{{ $state = $state | append "no-header" }}
{{ end }}
{{ if in . "<!-- no-footer -->" }}
{{ $state = $state | append "no-footer" }}
{{ end }}
<section{{ if $isHidden }} data-visibility="hidden"{{ end }} {{ if gt (len $state) 0 }}data-state="{{ delimit $state " " }}"{{ end }}>
{{ end }}
{{ $slideContent | safeHTML }}
</section>
{{ end }}
{{ end }}
{{ end }}
</div>
{{/* Branding elements - placed inside .reveal but outside .slides to be persistent and fixed */}}
{{/* Branding overlay (logo, title, author) */}}
{{ $pageContext := index . 0 }}
{{ partial "components/slide-branding" $pageContext }}
{{/* Hook: slide-header */}}
<div class="slide-header">
{{ partial "functions/slides_get_hook" (dict "hook" "slide-header" "context" $pageContext) }}
</div>
{{/* Hook: slide-footer */}}
<div class="slide-footer">
{{ partial "functions/slides_get_hook" (dict "hook" "slide-footer" "context" $pageContext) }}
</div>
</div>