2 Commits
Author SHA1 Message Date
danielandClaude Sonnet 5 ec9cba0555 Add lead shortcode; make banner a full-bleed hero image
- lead: wraps content in a Bootstrap .lead paragraph (moved from the
  ctsmockup site, where {.lead} could not target a paragraph).
- banner: resolves src as a page/global resource or base-URL-aware
  link, and spans the full viewport width via symmetric
  calc(50% - 50vw) margins while page content stays in .container.
  Optional height crops via object-fit: cover. A banner that starts a
  page's content is pulled flush against the navbar.
- html { overflow-x: hidden } to absorb the 100vw scrollbar overhang.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-02 09:53:20 +02:00
danielandClaude Sonnet 5 55308f7703 Respect base URL for nav logo; prefer logo.svg over favicon.svg
Reference the navbar brand image through relURL so it resolves
correctly when the site is served from a non-root base URL. Use
static/img/logo.svg when present, falling back to img/favicon.svg.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-02 09:44:44 +02:00
5 changed files with 94 additions and 6 deletions

No files matched your search

+31
View File
@@ -3,6 +3,37 @@
Simple Bootstrap-based theme for Hugo.
## Shortcodes
### `lead`
Wraps its content in a Bootstrap `.lead` paragraph (the Markdown
attribute syntax `{.lead}` cannot target a paragraph):
```
{{< lead >}}
An introductory paragraph that stands out.
{{< /lead >}}
```
Pass extra classes with `class`, e.g. `{{< lead class="mb-5" >}}`.
### `banner`
A full-bleed banner / hero image: it spans the entire viewport width
while the rest of the page stays within `.container`. Put it on the
first line of a page's content to get a hero flush against the navbar.
```
{{< banner src="hero.png" alt="…" >}}
```
`src` is resolved as a page resource first, then a global resource
(`assets/`), then as a plain link respecting the site's base URL.
Optional params: `title`, `height` (a CSS length such as `60vh`, which
crops the image with `object-fit: cover`) and `class`.
## Custom error page
The theme has a custom 404 error page.
+22 -1
View File
@@ -15,6 +15,12 @@
--bs-body-line-height: 1.5;
}
// Keep the full-bleed `.banner` from adding a horizontal scrollbar
// (100vw is wider than the viewport when a vertical scrollbar is shown).
html {
overflow-x: hidden;
}
body {
font-family: var(--bs-font-sans-serif);
line-height: var(--bs-body-line-height);
@@ -61,8 +67,23 @@ h1, h2, h3, h4, h5 {
}
}
// Images
// Full-bleed banner / hero image: spans the viewport width while the
// surrounding page content stays within `.container`. Works from inside
// any centred `.container` because the horizontal margins cancel out the
// container offset (50% of the parent - 50% of the viewport).
.banner {
display: block;
width: 100vw;
max-width: 100vw;
margin-left: calc(50% - 50vw);
margin-right: calc(50% - 50vw);
margin-bottom: 2rem;
}
// When the banner is the first thing in the page body, pull it flush
// against the navbar by cancelling the layout's top padding (`py-5`).
.content-body > .banner:first-child,
.content-body > p:first-child > .banner:only-child {
margin-top: -3rem;
}
+3 -1
View File
@@ -1,7 +1,9 @@
<nav class="navbar navbar-expand-lg navbar-light bg-light sticky-top">
<div class="container"> <!-- Changed from container-fluid to container -->
<a class="navbar-brand fw-bold" href="{{ .Site.BaseURL }}">
<img src="/img/favicon.svg" alt="{{ .Site.Title }}" title="{{ .Site.Title }}">
{{- $logo := "img/favicon.svg" -}}
{{- if os.FileExists "static/img/logo.svg" -}}{{- $logo = "img/logo.svg" -}}{{- end -}}
<img src="{{ $logo | relURL }}" alt="{{ .Site.Title }}" title="{{ .Site.Title }}">
</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse"
+36 -4
View File
@@ -1,4 +1,36 @@
{{ $src := .Get "src" }}
{{ $alt := .Get "alt" }}
{{ $title := .Get "title" }}
<img class="banner img-fluid" src="{{ $src }}" alt="{{ $alt }}" title="{{ $title }}" width="100%">
{{- /*
Full-bleed banner / hero image.
The image spans the entire viewport width while the surrounding page
content stays within `.container` (see the `.banner` rules in
hugo_bootstrap_theme.scss). Place the shortcode as the first line of a
page's content to get a hero that sits flush against the navbar.
Params:
src image path - resolved as a page resource first, then a global
resource (assets/), then treated as a link/URL respecting the
site's base URL
alt alternative text (default: empty)
title optional title attribute
height optional CSS length (e.g. "60vh"); crops the image with
object-fit: cover
class optional extra CSS classes
*/ -}}
{{- $src := .Get "src" -}}
{{- $alt := or (.Get "alt") "" -}}
{{- $title := .Get "title" -}}
{{- $height := .Get "height" -}}
{{- $class := .Get "class" -}}
{{- $url := $src -}}
{{- with $.Page.Resources.GetMatch $src -}}
{{- $url = .RelPermalink -}}
{{- else -}}
{{- with resources.Get $src -}}
{{- $url = .RelPermalink -}}
{{- else -}}
{{- $url = $src | relURL -}}
{{- end -}}
{{- end -}}
<img class="banner{{ with $class }} {{ . }}{{ end }}" src="{{ $url }}" alt="{{ $alt }}"
{{- with $title }} title="{{ . }}"{{ end }}
{{- with $height }} style="height:{{ . }};object-fit:cover"{{ end }}>
+2
View File
@@ -0,0 +1,2 @@
{{ $additional_classes := .Get "class" }}
<p class="lead {{ $additional_classes }}">{{ .Inner | safeHTML }}</p>