sproutsite 0.5.22 → 0.5.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/README.md +35 -2
  2. package/THIRD_PARTY_NOTICES.md +2 -0
  3. package/VERSION +1 -1
  4. package/package.json +4 -2
  5. package/src/lib/sproutsite/branding.ts +188 -0
  6. package/src/lib/sproutsite/site-config.ts +16 -0
  7. package/src/lib/sproutsite/types.ts +3 -0
  8. package/src/package/config.ts +10 -1
  9. package/src/package/manifest.ts +4 -9
  10. package/src/package/starter-assets/README.md +82 -0
  11. package/src/package/starter-assets/manifest.json +95 -0
  12. package/src/package/starter-assets/public/LICENSE.txt +202 -0
  13. package/src/package/starter-assets/public/NOTICE.txt +10 -0
  14. package/src/package/starter-assets/public/branding/apple-touch-icon.png +0 -0
  15. package/src/package/starter-assets/public/branding/favicon-16.png +0 -0
  16. package/src/package/starter-assets/public/branding/favicon-32.png +0 -0
  17. package/src/package/starter-assets/public/branding/favicon-48.png +0 -0
  18. package/src/package/starter-assets/public/branding/favicon.ico +0 -0
  19. package/src/package/starter-assets/public/branding/favicon.svg +1 -0
  20. package/src/package/starter-assets/public/branding/icon-192.png +0 -0
  21. package/src/package/starter-assets/public/branding/icon-512.png +0 -0
  22. package/src/package/starter-assets/public/branding/logo-light.svg +1 -0
  23. package/src/package/starter-assets/public/branding/logo.svg +1 -0
  24. package/src/package/starter-assets/public/branding/sharing-image.png +0 -0
  25. package/src/package/starter-assets/public/images/hero.jpg +0 -0
  26. package/src/package/starter-assets/sources/hero.svg +12 -0
  27. package/src/package/starter-assets/sources/sharing-image.svg +18 -0
  28. package/src/themes/default/branding.ts +53 -0
  29. package/src/themes/default/components/atoms/BrandLogo/BrandLogo.astro +49 -12
  30. package/src/themes/default/components/atoms/BrandLogo/BrandLogo.css +28 -0
  31. package/src/themes/default/components/layout/Column/Column.css +4 -2
  32. package/src/themes/default/components/organisms/Footer/Footer.astro +1 -1
  33. package/src/themes/default/components/organisms/Footer/Footer.css +3 -1
  34. package/src/themes/default/components/organisms/Header/Header.astro +2 -2
  35. package/src/themes/default/components/organisms/Header/Header.css +7 -1
  36. package/src/themes/default/layouts/PageLayout/PageLayout.astro +23 -32
package/README.md CHANGED
@@ -636,9 +636,42 @@ Leave `PRIVACY_LOG_RETENTION_DAYS` empty until a time-based policy is implemente
636
636
 
637
637
  ### Logo and icons
638
638
 
639
- The reference-based sprout and three-layer symbol lives in `src/themes/default/assets/branding/`. `logo.svg` (navy wordmark), `logo-dark.svg` (white wordmark), `logo-monochrome.svg`, `icon.svg`, and `icon-monochrome.svg` are standalone vector assets with transparent backgrounds and outlined Nunito lettering. They need no external font. The shared `BrandLogo` atom follows the configured heading family and weight, inherits the light/dark text color, and is used in the header and footer. Consumer sites with a different `site.name` retain their own text wordmark.
639
+ Keep your own prepared branding files under `public/branding/` and configure them in `src/content/site.yaml`. This follows [Astro's public-file conventions](https://docs.astro.build/en/guides/images/#images-in-public): files are copied unchanged, not optimised. Do not edit installed package files.
640
640
 
641
- `favicon.svg` uses flat colors for small displays. The ICO contains native 16, 32, and 48 pixel frames; separate PNGs provide those sizes too. The Apple touch icon is 180 pixels; web app icons are 192 and 512 pixels, with navy backgrounds and safe internal padding. `PageLayout` links the icons and the static `/site.webmanifest` endpoint registered by `createSproutsiteConfig()` through Astro's standard `injectRoute()` API. Imported asset URLs and the configured base are respected; no CMS runtime or service worker is added. These are the default theme's icons; a differently branded consumer should replace them when replacing the theme. The Sproutsite social card is emitted only for the product site (`site.name: Sproutsite`).
641
+ ```yaml
642
+ branding:
643
+ logo:
644
+ src: /branding/logo.svg
645
+ srcOnDark: /branding/logo-light.svg
646
+ width: 180
647
+ height: 48
648
+ showName: false
649
+ icons:
650
+ favicon: /branding/favicon.svg
651
+ shortcut: /branding/favicon.ico
652
+ appleTouch: /branding/apple-touch-icon.png
653
+ app192: /branding/icon-192.png
654
+ app512: /branding/icon-512.png
655
+ sharingImage:
656
+ src: /branding/sharing-image.png
657
+ alt: A description of your website preview
658
+ ```
659
+
660
+ All branding sections are optional. Logos accept SVG, PNG, JPEG or WebP; `width` and `height` define the intended display box in pixels, scaled proportionally on narrow screens. `showName: true` places the configured website name beside a symbol using the heading typography; false displays a complete image wordmark with the website name as its accessible name. Without a logo, the name appears as text. `srcOnDark` is optional and used on the hero navbar, mobile menu and footer; the docked navbar uses `src`. Optional `branding.footerLogo` accepts the same fields and otherwise inherits `logo`.
661
+
662
+ `favicon` accepts SVG, PNG or ICO; `shortcut` accepts ICO. Apple touch and app icons require PNGs of exactly 180×180, 192×192 and 512×512 respectively. Omitted icon fields use neutral document icons, independently of the website name. `sharingImage` accepts PNG, JPEG or WebP and a non-empty alternative text; its real dimensions and absolute URL are emitted in Open Graph and Twitter metadata for any website. Without it, no sharing image is advertised. Per-page sharing-image overrides are not implemented.
663
+
664
+ Paths are public-root-relative, with no `public`, language or deployment prefix. Sproutsite applies `base` once. Configured paths must be existing files within `public/`; remote URLs, traversal, query strings and fragments are rejected. Astro verifies image formats and icon dimensions during startup/build. Localized `site.*.yaml` files inherit branding from `site.yaml` and may override individual nested fields, including image paths and translated `sharingImage.alt`. The shared `/site.webmanifest` uses the main configuration. Restart the dev server after configuration or branding-file changes. No runtime service, offline mode or consumer asset generator is added.
665
+
666
+ The Sproutsite demo uses the same configuration with its own files in `public/branding/`. Source artwork remains in `src/themes/default/assets/branding/`; `npm run branding:generate` reproduces it and synchronizes the demo's public copies, then regenerates the neutral starter set.
667
+
668
+ ### Copyable starter assets
669
+
670
+ `src/package/starter-assets/public/` is the single neutral source for new websites and the theme's fallback icons. It contains a document-symbol logo, light/dark-compatible variant, SVG/ICO/PNG favicons, Apple/app icons, a 1200×630 sharing image and a 1920×1080 hero example. These first-party SVG sources and their deterministic raster derivatives are licensed under Apache-2.0, with the unchanged full license and an attribution notice included in the copyable directory. The product demo assets are separate.
671
+
672
+ Resolve the public `sproutsite/starter-assets` package export to find `manifest.json`. Its version-1 contract includes `publicDirectory`, exact file paths and SHA-256 hashes, a ready-to-merge `branding` object, English/German sharing-image alternative text, and an optional hero-image copy mapping for Astro's local `image()` schema. See [the starter asset contract](src/package/starter-assets/README.md) for a Node/TypeScript example. The asset set is included in the npm archive; no additional package or runtime service is needed.
673
+
674
+ Run `npm run starter-assets:generate` after editing `public/branding/logo.svg` or `sources/*.svg` within the starter directory. Generation requires the repository's development dependencies and is not part of a consumer build. The separate `create-sproutsite` generator must vendor a reviewed snapshot before its release, copy binaries unchanged, preserve LICENSE.txt/NOTICE.txt and fill in the site's configuration. It must not fetch assets at user generation time, so `--no-install` remains functional. That generator update is maintained by its own agent; this repository does not claim that the published initializer already ships these files. See [the handoff](docs/create-sproutsite-starter-handoff.md).
642
675
 
643
676
  Brand colors are separate `--color-brand-*` tokens in `styles/foundation/tokens.css`; the existing semantic UI palette is unchanged. Run `npm run branding:generate` after changing the vector geometry or brand tokens, then `npm run format`. The TypeScript generator uses `fontkit` and `sharp` only during development. Its local source font is `scripts/assets/nunito-variable.ttf` from the [official Nunito distribution](https://github.com/google/fonts/tree/main/ofl/nunito), covered by the adjacent SIL Open Font License. Generated assets are committed and ordinary builds do not regenerate or download them.
644
677
 
@@ -57,6 +57,8 @@ No installed dependency license or NOTICE file was removed, overwritten, or reli
57
57
 
58
58
  ## Project branding and hero artwork
59
59
 
60
+ The demo copies of the project's icon, favicon, app icons and social card in `public/branding/` are unchanged copies of the corresponding authorized artwork below. The demo configures them through `site.yaml`, using the same public-file workflow as consumer sites. The separate neutral starter set under `src/package/starter-assets/` is first-party vector artwork and deterministic Sharp-derived raster/ICO files, licensed under Apache-2.0. Its document icon, abstract landscape and generic browser preview contain no Sproutsite logo, third-party artwork, embedded fonts or AI-generated imagery. The original document icon was moved from the former theme defaults directory; the theme imports the same canonical starter files directly. The copyable `public/` subtree contains the unchanged official Apache-2.0 text in LICENSE.txt and its attribution in NOTICE.txt. Keep those notices with redistributed starter assets; this adds no visible footer attribution requirement.
61
+
60
62
  On 2026-11-16, project maintainer Björn Hempel confirmed that the supplied logo reference and hero SVG were created with AI assistance and explicitly authorized making the following project artwork available under the Apache License, Version 2.0, to the extent he holds rights that he can license. The technical derivation is recorded below. No particular AI provider, model, or absence of third-party reference inputs is asserted by this confirmation.
61
63
 
62
64
  | Asset scope | Recorded origin and derivation | Release status |
package/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.22
1
+ 0.5.24
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sproutsite",
3
- "version": "0.5.22",
3
+ "version": "0.5.24",
4
4
  "license": "Apache-2.0",
5
5
  "author": "Björn Hempel",
6
6
  "description": "Agent-ready, Markdown-first Static CMS powered by Astro and TypeScript.",
@@ -30,6 +30,7 @@
30
30
  "./content": "./src/package/content.ts",
31
31
  "./config": "./src/package/config.ts",
32
32
  "./components": "./src/package/components.ts",
33
+ "./starter-assets": "./src/package/starter-assets/manifest.json",
33
34
  "./page": "./src/package/page.astro",
34
35
  "./package.json": "./package.json"
35
36
  },
@@ -40,7 +41,8 @@
40
41
  "postcss-selector-parser": "6.1.5"
41
42
  },
42
43
  "scripts": {
43
- "branding:generate": "node --import tsx scripts/generate-branding.ts",
44
+ "branding:generate": "node --import tsx scripts/generate-branding.ts && npm run starter-assets:generate",
45
+ "starter-assets:generate": "node --import tsx scripts/generate-starter-assets.ts",
44
46
  "dev": "astro dev --force",
45
47
  "build": "npm run validate && astro build && node --import tsx scripts/verify-build.ts",
46
48
  "build:demo": "SPROUTSITE_BASE=/demo/ npm run build",
@@ -0,0 +1,188 @@
1
+ import { readFileSync, realpathSync, statSync } from 'node:fs';
2
+ import { extname, relative, resolve, sep } from 'node:path';
3
+ import { imageMetadata } from 'astro/assets/utils';
4
+ import { z } from 'zod';
5
+
6
+ // Paths refer to Astro's standard public directory, without a deployment base.
7
+ const assetPath = z.string().refine(
8
+ (value) =>
9
+ /^\/(?!\/)[A-Za-z0-9_./-]+$/.test(value) &&
10
+ value
11
+ .slice(1)
12
+ .split('/')
13
+ .every((part) => part && part !== '.' && part !== '..'),
14
+ 'must be a root-relative public file path without a base, query, fragment or traversal',
15
+ );
16
+ const logoSchema = z
17
+ .object({
18
+ src: assetPath,
19
+ srcOnDark: assetPath.optional(),
20
+ width: z.number().int().positive().max(4096),
21
+ height: z.number().int().positive().max(4096),
22
+ showName: z.boolean().default(false),
23
+ })
24
+ .strict();
25
+
26
+ export const brandingSchema = z
27
+ .object({
28
+ logo: logoSchema.optional(),
29
+ footerLogo: logoSchema.optional(),
30
+ icons: z
31
+ .object({
32
+ favicon: assetPath.optional(),
33
+ shortcut: assetPath.optional(),
34
+ appleTouch: assetPath.optional(),
35
+ app192: assetPath.optional(),
36
+ app512: assetPath.optional(),
37
+ })
38
+ .strict()
39
+ .optional(),
40
+ sharingImage: z
41
+ .object({
42
+ src: assetPath,
43
+ alt: z.string().trim().min(1),
44
+ })
45
+ .strict()
46
+ .optional(),
47
+ })
48
+ .strict();
49
+
50
+ export type Branding = z.infer<typeof brandingSchema>;
51
+ export type BrandLogoConfig = z.infer<typeof logoSchema>;
52
+
53
+ /** Merge only branding: other locale settings retain their existing contract. */
54
+ export function inheritBranding(primary: unknown, localized: unknown): unknown {
55
+ if (localized === undefined) return primary;
56
+ const record = (value: unknown): value is Record<string, unknown> =>
57
+ typeof value === 'object' && value !== null && !Array.isArray(value);
58
+ if (!record(primary) || !record(localized)) return localized;
59
+ const merged = { ...primary, ...localized };
60
+ for (const key of ['logo', 'footerLogo', 'icons', 'sharingImage']) {
61
+ if (record(primary[key]) && record(localized[key]))
62
+ merged[key] = { ...primary[key], ...localized[key] };
63
+ }
64
+ return merged;
65
+ }
66
+
67
+ export function publicBrandingFile(src: string, root = process.cwd()): string {
68
+ if (!assetPath.safeParse(src).success)
69
+ throw new Error(`Unsafe branding path: ${src}`);
70
+ const directory = realpathSync(resolve(root, 'public'));
71
+ const file = realpathSync(resolve(directory, `.${src}`));
72
+ const within = relative(directory, file);
73
+ if (
74
+ within.startsWith(`..${sep}`) ||
75
+ within === '..' ||
76
+ !statSync(file).isFile()
77
+ )
78
+ throw new Error(`Branding asset must be a file inside public/: ${src}`);
79
+ return file;
80
+ }
81
+
82
+ function assets(branding: Branding) {
83
+ return [
84
+ ...(['logo', 'footerLogo'] as const).flatMap((key) => {
85
+ const logo = branding[key];
86
+ return logo
87
+ ? [
88
+ {
89
+ field: `${key}.src`,
90
+ src: logo.src,
91
+ formats: ['svg', 'png', 'jpeg', 'webp'],
92
+ },
93
+ ...(logo.srcOnDark
94
+ ? [
95
+ {
96
+ field: `${key}.srcOnDark`,
97
+ src: logo.srcOnDark,
98
+ formats: ['svg', 'png', 'jpeg', 'webp'],
99
+ },
100
+ ]
101
+ : []),
102
+ ]
103
+ : [];
104
+ }),
105
+ ...Object.entries(branding.icons ?? {}).map(([key, src]) => ({
106
+ field: `icons.${key}`,
107
+ src,
108
+ formats:
109
+ key === 'favicon'
110
+ ? ['svg', 'png', 'ico']
111
+ : key === 'shortcut'
112
+ ? ['ico']
113
+ : ['png'],
114
+ })),
115
+ ...(branding.sharingImage
116
+ ? [
117
+ {
118
+ field: 'sharingImage.src',
119
+ src: branding.sharingImage.src,
120
+ formats: ['png', 'jpeg', 'webp'],
121
+ },
122
+ ]
123
+ : []),
124
+ ];
125
+ }
126
+
127
+ /** Fast, synchronous checks also run through npm run validate. */
128
+ export function validateBrandingFiles(
129
+ branding: Branding | undefined,
130
+ root: string,
131
+ source: string,
132
+ ): void {
133
+ for (const asset of assets(branding ?? {})) {
134
+ try {
135
+ publicBrandingFile(asset.src, root);
136
+ const extension = extname(asset.src)
137
+ .slice(1)
138
+ .toLowerCase()
139
+ .replace('jpg', 'jpeg');
140
+ if (!asset.formats.includes(extension))
141
+ throw new Error(`expected ${asset.formats.join(', ')}`);
142
+ } catch (error) {
143
+ throw new Error(
144
+ `Invalid ${source}: branding.${asset.field} (${asset.src}): ${error instanceof Error ? error.message : String(error)}`,
145
+ );
146
+ }
147
+ }
148
+ }
149
+
150
+ export async function brandingImageMetadata(src: string, root = process.cwd()) {
151
+ return imageMetadata(readFileSync(publicBrandingFile(src, root)), src);
152
+ }
153
+
154
+ /** Astro's image reader verifies file contents and required app-icon dimensions. */
155
+ export async function validateBrandingImages(
156
+ branding: Branding | undefined,
157
+ root = process.cwd(),
158
+ ): Promise<void> {
159
+ for (const asset of assets(branding ?? {})) {
160
+ try {
161
+ const metadata = await brandingImageMetadata(asset.src, root);
162
+ const extension = extname(asset.src)
163
+ .slice(1)
164
+ .toLowerCase()
165
+ .replace('jpg', 'jpeg');
166
+ // Astro reports JPEG metadata as jpg, regardless of .jpg/.jpeg.
167
+ const format = metadata.format === 'jpg' ? 'jpeg' : metadata.format;
168
+ if (format !== extension)
169
+ throw new Error('image content must match the file extension');
170
+ if (!asset.formats.includes(format))
171
+ throw new Error(
172
+ 'file content does not match the allowed image formats',
173
+ );
174
+ const sizes: Record<string, number> = {
175
+ 'icons.appleTouch': 180,
176
+ 'icons.app192': 192,
177
+ 'icons.app512': 512,
178
+ };
179
+ const size = sizes[asset.field];
180
+ if (size && (metadata.width !== size || metadata.height !== size))
181
+ throw new Error(`expected ${size} × ${size} pixels`);
182
+ } catch (error) {
183
+ throw new Error(
184
+ `Invalid branding.${asset.field} (${asset.src}): ${error instanceof Error ? error.message : String(error)}`,
185
+ );
186
+ }
187
+ }
188
+ }
@@ -3,6 +3,11 @@ import { resolve } from 'node:path';
3
3
  import { z } from 'zod';
4
4
  import { parse } from 'yaml';
5
5
  import type { SiteConfig } from './types.js';
6
+ import {
7
+ brandingSchema,
8
+ inheritBranding,
9
+ validateBrandingFiles,
10
+ } from './branding.js';
6
11
 
7
12
  const linkSchema = z.object({
8
13
  label: z.string().trim().min(1),
@@ -57,6 +62,7 @@ const fontSelectionSchema = z
57
62
  .default({ family: 'serif', weight: 500 });
58
63
 
59
64
  const siteSchema = z.object({
65
+ branding: brandingSchema.optional(),
60
66
  typography: z
61
67
  .object({
62
68
  headings: fontSelectionSchema,
@@ -174,6 +180,15 @@ export function loadSiteConfig(
174
180
  locale && locale !== 'en' ? `site.${locale}.yaml` : 'site.yaml';
175
181
  const source = resolve(root, 'src/content', filename);
176
182
  const raw = parse(readFileSync(source, 'utf8'));
183
+ if (
184
+ filename !== 'site.yaml' &&
185
+ typeof raw === 'object' &&
186
+ raw !== null &&
187
+ !Array.isArray(raw)
188
+ ) {
189
+ const primary = loadSiteConfig(undefined, root);
190
+ raw.branding = inheritBranding(primary.branding, raw.branding);
191
+ }
177
192
  const parsed = siteSchema.safeParse(raw);
178
193
  if (!parsed.success) {
179
194
  throw new Error(
@@ -182,6 +197,7 @@ export function loadSiteConfig(
182
197
  }
183
198
  const { 'hero-classes': heroClasses, ...site } = parsed.data;
184
199
  const config: SiteConfig = { ...site, heroClasses };
200
+ validateBrandingFiles(config.branding, root, `src/content/${filename}`);
185
201
  const environmentBase = process.env.SPROUTSITE_BASE;
186
202
  if (environmentBase === undefined) return config;
187
203
  const base = siteSchema.shape.base.safeParse(environmentBase);
@@ -1,3 +1,5 @@
1
+ import type { Branding } from './branding.js';
2
+
1
3
  export const tones = ['default', 'muted', 'brand'] as const;
2
4
  export type Tone = (typeof tones)[number];
3
5
  export type SectionTone = Tone | { odd: Tone; even: Tone };
@@ -28,6 +30,7 @@ export type HeaderItem =
28
30
  | { type: 'language-switcher' };
29
31
 
30
32
  export interface SiteConfig {
33
+ branding?: Branding;
31
34
  name: string;
32
35
  url: string;
33
36
  base: string;
@@ -17,6 +17,7 @@ import { remarkContentLinks } from '../lib/sproutsite/remark-links.js';
17
17
  import { loadSiteConfig } from '../lib/sproutsite/site-config.js';
18
18
  import { validateSproutsiteContent } from '../lib/sproutsite/validation.js';
19
19
  import { createSitemapMetadata } from '../lib/sproutsite/sitemap.js';
20
+ import { validateBrandingImages } from '../lib/sproutsite/branding.js';
20
21
 
21
22
  /** Returns the Astro configuration required by the default Sproutsite theme. */
22
23
  export function createSproutsiteConfig() {
@@ -58,7 +59,15 @@ export function createSproutsiteConfig() {
58
59
  {
59
60
  name: 'sproutsite/default-routes',
60
61
  hooks: {
61
- 'astro:config:setup': ({ injectRoute }) => {
62
+ 'astro:config:setup': async ({ injectRoute }) => {
63
+ for (const locale of site.locales) {
64
+ await validateBrandingImages(
65
+ (locale === site.language
66
+ ? site
67
+ : loadSiteConfig(locale)
68
+ ).branding,
69
+ );
70
+ }
62
71
  injectRoute({
63
72
  pattern: '/404',
64
73
  entrypoint: new URL('./404.astro', import.meta.url),
@@ -1,12 +1,12 @@
1
1
  import type { APIRoute } from 'astro';
2
- import icon192 from '../themes/default/assets/branding/icon-192x192.png';
3
- import icon512 from '../themes/default/assets/branding/icon-512x512.png';
2
+ import { resolveBranding } from '../themes/default/branding.js';
4
3
  import { loadSiteConfig } from '../lib/sproutsite/site-config.js';
5
4
 
6
5
  // A native static Astro endpoint keeps bundled, hashed icon URLs correct for
7
6
  // both package consumers and deployments under a base path. No service worker.
8
- export const GET: APIRoute = () => {
7
+ export const GET: APIRoute = async () => {
9
8
  const site = loadSiteConfig();
9
+ const branding = await resolveBranding(site);
10
10
  return new Response(
11
11
  JSON.stringify({
12
12
  name: site.name,
@@ -15,12 +15,7 @@ export const GET: APIRoute = () => {
15
15
  start_url: site.base,
16
16
  scope: site.base,
17
17
  display: 'browser',
18
- icons: [icon192, icon512].map((icon) => ({
19
- src: icon.src,
20
- sizes: `${icon.width}x${icon.height}`,
21
- type: 'image/png',
22
- purpose: 'any',
23
- })),
18
+ icons: branding.appIcons,
24
19
  }),
25
20
  { headers: { 'Content-Type': 'application/manifest+json' } },
26
21
  );
@@ -0,0 +1,82 @@
1
+ # Neutral website starter assets
2
+
3
+ Sproutsite maintains this asset set. The separate `create-sproutsite` project
4
+ vendors a reviewed snapshot when preparing its own release. It must not download
5
+ assets or install Sproutsite just to create files for an end user.
6
+
7
+ ## Public entry and copy contract
8
+
9
+ Resolve `sproutsite/starter-assets` to locate `manifest.json` in the installed
10
+ package. This is a public export, not a private theme path:
11
+
12
+ ```ts
13
+ import { createRequire } from 'node:module';
14
+ import { dirname, join } from 'node:path';
15
+ import { readFileSync } from 'node:fs';
16
+
17
+ const require = createRequire(import.meta.url);
18
+ const manifestFile = require.resolve('sproutsite/starter-assets');
19
+ const manifest = JSON.parse(readFileSync(manifestFile, 'utf8'));
20
+ const publicDirectory = join(dirname(manifestFile), manifest.publicDirectory);
21
+ ```
22
+
23
+ Manifest schema version 1 contains:
24
+
25
+ - `publicDirectory`: the directory whose **contents** are copied to the website's
26
+ `public/`, preserving names and binary data. It includes LICENSE.txt and
27
+ NOTICE.txt; preserve both with the assets.
28
+ - `files`: the exact recursive public-file list and SHA-256 hashes. Verify paths
29
+ remain inside the directory and compare the vendored snapshot before release.
30
+ - `branding`: a complete neutral configuration to merge into `site.yaml`.
31
+ `showName: true` displays the generated website's actual name beside a neutral
32
+ document symbol. The icon intentionally works on light and dark backgrounds.
33
+ - `localizedSharingImageAlt`: English and German alternative text. The generator
34
+ may personalize this with the chosen website name; do not replace tokens in
35
+ image files.
36
+ - `heroExample`: an optional existing-API integration. Copy its `source` to
37
+ `contentDestination` and merge `frontmatter` into the homepage hero. Use the
38
+ same local asset for both languages. The hero's `image()` schema expects a
39
+ relative content image, not a public URL. Set `classes: null` to remove the
40
+ default decorative waves when enabling the raster example.
41
+
42
+ Do not merge a second duplicate `branding` YAML key. Keep the existing name,
43
+ URL, locale, typography and navigation configuration. Locale files inherit the
44
+ main configuration and can override `sharingImage.alt`.
45
+
46
+ ## Files and ownership
47
+
48
+ `public/branding/` contains logo.svg, logo-light.svg, favicon.svg, favicon.ico,
49
+ 16/32/48-pixel PNG favicon variants, a 180-pixel Apple touch icon, 192/512-pixel
50
+ app icons and a 1200×630 sharing-image.png. `public/images/hero.jpg` is 1920×1080.
51
+ The optional PNG favicon variants are available for consumers needing them;
52
+ the current branding API uses `favicon` for one preferred SVG, PNG or ICO.
53
+
54
+ The SVG symbol in `public/branding/logo.svg` and the illustrations in `sources/`
55
+ are first-party vector sources without third-party imagery, font dependencies
56
+ or a Sproutsite wordmark. Raster images and ICO frames are derived locally with
57
+ Sharp. There is no AI image-generation input or provider restriction to resolve
58
+ for this set. All these assets follow Apache-2.0; see the unchanged full license
59
+ and the attribution notice inside `public/`. No additional visible attribution
60
+ or branding requirement is imposed.
61
+
62
+ ## Maintenance
63
+
64
+ Run `npm run starter-assets:generate` from the Sproutsite repository after
65
+ editing the vector sources. This updates derivatives, copies the official
66
+ project license unchanged and regenerates the file hashes. The command requires
67
+ development dependencies; website builds and generation do not execute it.
68
+ `npm run branding:generate` also calls it after regenerating the demo branding.
69
+
70
+ The default theme imports its neutral fallback icons directly from this set.
71
+ Do not maintain a second fallback asset directory. Sproutsite's own demo uses
72
+ separate, explicitly configured product files under the repository's root
73
+ `public/branding/`; those are not the starter artwork.
74
+
75
+ Check `npm test` and `npm run test:package` before publishing. The archive test
76
+ resolves the exported manifest from a real installation, verifies every asset
77
+ and builds the copied starter configuration. Package files are committed here;
78
+ consumer projects own their copies and package updates do not overwrite them.
79
+
80
+ The initializer needs its own change and release before it includes this set.
81
+ This repository does not claim that an existing npm version of
82
+ `create-sproutsite` already includes it.
@@ -0,0 +1,95 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "license": "Apache-2.0",
4
+ "publicDirectory": "public",
5
+ "branding": {
6
+ "logo": {
7
+ "src": "/branding/logo.svg",
8
+ "srcOnDark": "/branding/logo-light.svg",
9
+ "width": 40,
10
+ "height": 40,
11
+ "showName": true
12
+ },
13
+ "icons": {
14
+ "favicon": "/branding/favicon.svg",
15
+ "shortcut": "/branding/favicon.ico",
16
+ "appleTouch": "/branding/apple-touch-icon.png",
17
+ "app192": "/branding/icon-192.png",
18
+ "app512": "/branding/icon-512.png"
19
+ },
20
+ "sharingImage": {
21
+ "src": "/branding/sharing-image.png",
22
+ "alt": "Website preview"
23
+ }
24
+ },
25
+ "localizedSharingImageAlt": {
26
+ "en": "Website preview",
27
+ "de": "Website-Vorschau"
28
+ },
29
+ "heroExample": {
30
+ "source": "public/images/hero.jpg",
31
+ "contentDestination": "src/content/pages/_assets/hero.jpg",
32
+ "frontmatter": {
33
+ "background-image": "./_assets/hero.jpg",
34
+ "classes": null
35
+ }
36
+ },
37
+ "files": [
38
+ {
39
+ "path": "LICENSE.txt",
40
+ "sha256": "cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30"
41
+ },
42
+ {
43
+ "path": "NOTICE.txt",
44
+ "sha256": "754e1fad287bf83ae88e5dc951cc49bbe36ccb0241f97399f889603126bbf50f"
45
+ },
46
+ {
47
+ "path": "branding/apple-touch-icon.png",
48
+ "sha256": "eb802c304b3efdf7c7ede139a82d32bbad336eff4c087c2a9c00ee284bec8b6a"
49
+ },
50
+ {
51
+ "path": "branding/favicon-16.png",
52
+ "sha256": "25167598ddb3386f6b61acc729c9e33dd9dbb00d7ac0241e94f143c0e271b9c1"
53
+ },
54
+ {
55
+ "path": "branding/favicon-32.png",
56
+ "sha256": "ba036d8493c80e7c6969c78627ebffc1afd2a1b72758744d7bb3cf507f30f77e"
57
+ },
58
+ {
59
+ "path": "branding/favicon-48.png",
60
+ "sha256": "cf17c47a2d989c22ce0e40b15a4bbaa0405a629a5b93d6e0c6d61892f975d9e7"
61
+ },
62
+ {
63
+ "path": "branding/favicon.ico",
64
+ "sha256": "f6586cc8917ecb6d5457665a3f5f75f77e0a798d2d56875e325d131691d2b152"
65
+ },
66
+ {
67
+ "path": "branding/favicon.svg",
68
+ "sha256": "9e5746bcfefe182d42a141e8898f0b2b14bb17f9bcdc92d5aa14b9202d99425b"
69
+ },
70
+ {
71
+ "path": "branding/icon-192.png",
72
+ "sha256": "6152c4f90c8c2588132b2fe7f06c7aa8ea21760ae80ae22990d729c78ba4291a"
73
+ },
74
+ {
75
+ "path": "branding/icon-512.png",
76
+ "sha256": "13c33d3d368697baffeb8538cb09a33a8401d5318963f29d6a8624af4d852ac7"
77
+ },
78
+ {
79
+ "path": "branding/logo-light.svg",
80
+ "sha256": "9e5746bcfefe182d42a141e8898f0b2b14bb17f9bcdc92d5aa14b9202d99425b"
81
+ },
82
+ {
83
+ "path": "branding/logo.svg",
84
+ "sha256": "9e5746bcfefe182d42a141e8898f0b2b14bb17f9bcdc92d5aa14b9202d99425b"
85
+ },
86
+ {
87
+ "path": "branding/sharing-image.png",
88
+ "sha256": "fc6092abc0a08976f9d3123c45ab2b631e22001f06ea0d9c26631d1c70ddd694"
89
+ },
90
+ {
91
+ "path": "images/hero.jpg",
92
+ "sha256": "05d1648cdf25a5463d849a3eb984caf8ca8705fccca5f333bc96c51b1c706948"
93
+ }
94
+ ]
95
+ }
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,10 @@
1
+ Neutral website starter assets
2
+ Copyright 2026 Björn Hempel
3
+
4
+ These first-party neutral illustrations and icons were prepared for Sproutsite.
5
+ Source project: https://github.com/sproutsite/sproutsite
6
+
7
+ Licensed under the Apache License, Version 2.0. See LICENSE.txt in this directory.
8
+ The artwork contains no Sproutsite logo, third-party images or embedded fonts.
9
+ Preserve applicable notices when redistributing these files. No visible website
10
+ footer attribution is required by this notice.
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 64 64"><rect width="64" height="64" rx="14" fill="#e2e8f0"/><rect x="14" y="12" width="36" height="40" rx="5" fill="#fff" stroke="#475569" stroke-width="3"/><path d="M23 25h18M23 33h18M23 41h10" fill="none" stroke="#475569" stroke-width="3" stroke-linecap="round"/></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 64 64"><rect width="64" height="64" rx="14" fill="#e2e8f0"/><rect x="14" y="12" width="36" height="40" rx="5" fill="#fff" stroke="#475569" stroke-width="3"/><path d="M23 25h18M23 33h18M23 41h10" fill="none" stroke="#475569" stroke-width="3" stroke-linecap="round"/></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 64 64"><rect width="64" height="64" rx="14" fill="#e2e8f0"/><rect x="14" y="12" width="36" height="40" rx="5" fill="#fff" stroke="#475569" stroke-width="3"/><path d="M23 25h18M23 33h18M23 41h10" fill="none" stroke="#475569" stroke-width="3" stroke-linecap="round"/></svg>
@@ -0,0 +1,12 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="1920" height="1080" viewBox="0 0 1920 1080">
2
+ <defs>
3
+ <linearGradient id="sky" x2="0" y2="1"><stop stop-color="#d9e3eb"/><stop offset="1" stop-color="#f5f7fa"/></linearGradient>
4
+ <linearGradient id="far" x1="0" y1="0" x2="1" y2="1"><stop stop-color="#134b70"/><stop offset="1" stop-color="#0f766e"/></linearGradient>
5
+ <linearGradient id="middle" x1="0" y1="0" x2="1" y2="1"><stop stop-color="#70c6df"/><stop offset="1" stop-color="#3f8b99"/></linearGradient>
6
+ <linearGradient id="near" x1="0" y1="0" x2="1" y2="1"><stop stop-color="#d9e8e9"/><stop offset="1" stop-color="#a5c8cd"/></linearGradient>
7
+ </defs>
8
+ <path fill="url(#sky)" d="M0 0h1920v1080H0z"/>
9
+ <path fill="url(#far)" d="M0 710C280 740 460 480 760 540S1210 210 1500 340s310 130 420 50v690H0z"/>
10
+ <path fill="url(#middle)" d="M0 820c310-200 540-120 810-80s410-150 670-90 310 90 440 20v410H0z"/>
11
+ <path fill="url(#near)" d="M0 930c310 40 480-100 790-30s570 50 1130-70v250H0z"/>
12
+ </svg>
@@ -0,0 +1,18 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="1200" height="630" viewBox="0 0 1200 630">
2
+ <defs>
3
+ <linearGradient id="wall" x2="0" y2="1"><stop stop-color="#d9e3eb"/><stop offset="1" stop-color="#f5f7fa"/></linearGradient>
4
+ <linearGradient id="wave"><stop stop-color="#134b70"/><stop offset="1" stop-color="#0f766e"/></linearGradient>
5
+ <linearGradient id="panel" x2="0" y2="1"><stop stop-color="#fff"/><stop offset="1" stop-color="#edf2f6"/></linearGradient>
6
+ </defs>
7
+ <path fill="url(#wall)" d="M0 0h1200v630H0z"/>
8
+ <path fill="url(#wave)" d="M0 390c220-160 330-40 560-150s390-170 640-70v460H0z"/>
9
+ <ellipse cx="600" cy="544" rx="340" ry="25" fill="#071a36" opacity=".1"/>
10
+ <rect x="280" y="130" width="640" height="390" rx="30" fill="url(#panel)" stroke="#cbd5df" stroke-width="2"/>
11
+ <path d="M280 195h640" stroke="#d9e3eb" stroke-width="2"/>
12
+ <g fill="#94a3b8"><circle cx="315" cy="165" r="6"/><circle cx="339" cy="165" r="6"/><circle cx="363" cy="165" r="6"/></g>
13
+ <rect x="325" y="240" width="230" height="225" rx="16" fill="#d9e8e9"/>
14
+ <path d="M325 394c70-90 130-30 230-65v120q0 16-16 16H341q-16 0-16-16z" fill="#3f8b99"/>
15
+ <g fill="#475569"><rect x="600" y="250" width="235" height="16" rx="8"/><rect x="600" y="284" width="180" height="16" rx="8"/></g>
16
+ <g fill="#cbd5df"><rect x="600" y="332" width="250" height="9" rx="4.5"/><rect x="600" y="357" width="220" height="9" rx="4.5"/><rect x="600" y="382" width="240" height="9" rx="4.5"/></g>
17
+ <rect x="600" y="425" width="125" height="38" rx="10" fill="#0f766e"/>
18
+ </svg>
@@ -0,0 +1,53 @@
1
+ import favicon from '../../package/starter-assets/public/branding/favicon.svg?url&no-inline';
2
+ import appleTouch from '../../package/starter-assets/public/branding/apple-touch-icon.png';
3
+ import app192 from '../../package/starter-assets/public/branding/icon-192.png';
4
+ import app512 from '../../package/starter-assets/public/branding/icon-512.png';
5
+ import type { SiteConfig } from '../../lib/sproutsite/types.js';
6
+ import { withBase } from '../../lib/sproutsite/urls.js';
7
+ import { brandingImageMetadata } from '../../lib/sproutsite/branding.js';
8
+
9
+ /** Theme defaults are neutral; all configured files belong to the website. */
10
+ export async function resolveBranding(site: SiteConfig) {
11
+ const icons = site.branding?.icons;
12
+ const publicUrl = (src: string) => withBase(src, site.base);
13
+ const faviconSrc = icons?.favicon ? publicUrl(icons.favicon) : favicon;
14
+ const faviconType = faviconSrc.toLowerCase().endsWith('.svg')
15
+ ? 'image/svg+xml'
16
+ : faviconSrc.toLowerCase().endsWith('.png')
17
+ ? 'image/png'
18
+ : 'image/x-icon';
19
+ const sharing = site.branding?.sharingImage;
20
+ const metadata = sharing
21
+ ? await brandingImageMetadata(sharing.src)
22
+ : undefined;
23
+ return {
24
+ favicon: { src: faviconSrc, type: faviconType },
25
+ shortcut: icons?.shortcut ? publicUrl(icons.shortcut) : undefined,
26
+ appleTouch: icons?.appleTouch
27
+ ? publicUrl(icons.appleTouch)
28
+ : appleTouch.src,
29
+ appIcons: [
30
+ {
31
+ src: icons?.app192 ? publicUrl(icons.app192) : app192.src,
32
+ sizes: '192x192',
33
+ type: 'image/png',
34
+ purpose: 'any',
35
+ },
36
+ {
37
+ src: icons?.app512 ? publicUrl(icons.app512) : app512.src,
38
+ sizes: '512x512',
39
+ type: 'image/png',
40
+ purpose: 'any',
41
+ },
42
+ ],
43
+ sharingImage:
44
+ sharing && metadata
45
+ ? {
46
+ src: new URL(publicUrl(sharing.src), site.url).href,
47
+ alt: sharing.alt,
48
+ width: metadata.width,
49
+ height: metadata.height,
50
+ }
51
+ : undefined,
52
+ };
53
+ }
@@ -1,10 +1,18 @@
1
1
  ---
2
- import icon from '../../../assets/branding/icon.svg?url&no-inline';
2
+ import type { SiteConfig } from '../../../../../lib/sproutsite/types.js';
3
+ import { withBase } from '../../../../../lib/sproutsite/urls.js';
3
4
 
4
5
  interface Props {
5
- name: string;
6
+ site: SiteConfig;
7
+ placement?: 'header' | 'footer';
6
8
  }
7
- const { name } = Astro.props;
9
+ const { site, placement = 'header' } = Astro.props;
10
+ const { name } = site;
11
+ const logo =
12
+ placement === 'footer'
13
+ ? (site.branding?.footerLogo ?? site.branding?.logo)
14
+ : site.branding?.logo;
15
+ const showName = logo?.showName ?? true;
8
16
  const highlight = name === 'Sproutsite' ? 'site' : undefined;
9
17
  const highlightStart = highlight ? name.indexOf(highlight) : -1;
10
18
  const hasHighlight = highlightStart >= 0 && highlight !== undefined;
@@ -14,13 +22,42 @@ const nameAfterHighlight = hasHighlight
14
22
  : undefined;
15
23
  ---
16
24
 
17
- <span class="ss-brand-logo">
18
- {name === 'Sproutsite' && <img src={icon} width="40" height="40" alt="" />}
19
- <span class="ss-brand-logo__name">
20
- {nameBeforeHighlight}
21
- {hasHighlight && (
22
- <span class="ss-brand-logo__highlight">{highlight}</span>
23
- )}
24
- {nameAfterHighlight}
25
- </span>
25
+ <span class:list={['ss-brand-logo', { 'ss-brand-logo--custom': logo }]}>
26
+ {logo && (
27
+ <span
28
+ class="ss-brand-logo__image"
29
+ role={showName ? undefined : 'img'}
30
+ aria-label={showName ? undefined : name}
31
+ style={{
32
+ '--ss-logo-width': `${logo.width / 16}rem`,
33
+ '--ss-logo-ratio': `${logo.width} / ${logo.height}`,
34
+ }}
35
+ >
36
+ <img
37
+ class="ss-brand-logo__light"
38
+ src={withBase(logo.src, site.base)}
39
+ width={logo.width}
40
+ height={logo.height}
41
+ alt=""
42
+ />
43
+ {logo.srcOnDark && (
44
+ <img
45
+ class="ss-brand-logo__dark"
46
+ src={withBase(logo.srcOnDark, site.base)}
47
+ width={logo.width}
48
+ height={logo.height}
49
+ alt=""
50
+ />
51
+ )}
52
+ </span>
53
+ )}
54
+ {showName && (
55
+ <span class="ss-brand-logo__name">
56
+ {nameBeforeHighlight}
57
+ {hasHighlight && (
58
+ <span class="ss-brand-logo__highlight">{highlight}</span>
59
+ )}
60
+ {nameAfterHighlight}
61
+ </span>
62
+ )}
26
63
  </span>
@@ -18,5 +18,33 @@
18
18
  .ss-brand-logo__highlight {
19
19
  color: var(--ss-brand-highlight, var(--color-hero-cyan));
20
20
  }
21
+
22
+ &.ss-brand-logo--custom {
23
+ max-width: 100%;
24
+
25
+ .ss-brand-logo__image {
26
+ display: grid;
27
+ flex-shrink: 1;
28
+ width: var(--ss-logo-width);
29
+ max-width: min(16rem, 45vw);
30
+ aspect-ratio: var(--ss-logo-ratio);
31
+
32
+ img {
33
+ grid-area: 1 / 1;
34
+ width: 100%;
35
+ height: 100%;
36
+ min-height: 0;
37
+ object-fit: contain;
38
+ }
39
+
40
+ &:has(.ss-brand-logo__dark) .ss-brand-logo__light {
41
+ visibility: var(--ss-logo-light-visibility, visible);
42
+ }
43
+
44
+ .ss-brand-logo__dark {
45
+ visibility: var(--ss-logo-dark-visibility, hidden);
46
+ }
47
+ }
48
+ }
21
49
  }
22
50
  }
@@ -7,11 +7,13 @@
7
7
  margin-top: 0;
8
8
  }
9
9
 
10
- > :first-child:not(.ss-button) {
10
+ /* Astro can emit scripts beside slotted components. Ignore those
11
+ non-rendered siblings when trimming the outer content margins. */
12
+ > :nth-child(1 of :not(script, style, template)):not(.ss-button) {
11
13
  @apply mt-0;
12
14
  }
13
15
 
14
- > :last-child:not(.ss-button) {
16
+ > :nth-last-child(1 of :not(script, style, template)):not(.ss-button) {
15
17
  @apply mb-0;
16
18
  }
17
19
 
@@ -36,7 +36,7 @@ const linkAttributes = (href: string) => ({
36
36
  href={contentHref('/', site)}
37
37
  aria-label={`${site.name}: ${t(language, 'home')}`}
38
38
  >
39
- <BrandLogo name={site.name} />
39
+ <BrandLogo site={site} placement="footer" />
40
40
  </a>
41
41
  <p>{site.footer.text}</p>
42
42
  </div>
@@ -1,5 +1,7 @@
1
1
  @layer components {
2
2
  .ss-footer {
3
+ --ss-logo-light-visibility: hidden;
4
+ --ss-logo-dark-visibility: visible;
3
5
  border-top: 1px solid
4
6
  color-mix(
5
7
  in srgb,
@@ -71,7 +73,7 @@
71
73
  @media (width < 72rem) {
72
74
  gap: 0.5rem;
73
75
  }
74
- img {
76
+ &:not(.ss-brand-logo--custom) img {
75
77
  width: 3rem;
76
78
  height: 3rem;
77
79
  }
@@ -26,7 +26,7 @@ const hasLanguageSwitcher = site.header.links.some(
26
26
  <header class="ss-header">
27
27
  <div class="ss-header__inner site-shell">
28
28
  <a class="ss-header__brand" href={contentHref('/', site)}>
29
- <BrandLogo name={site.name} />
29
+ <BrandLogo site={site} />
30
30
  </a>
31
31
  <div class="ss-header__mobile-tools">
32
32
  {hasLanguageSwitcher && (
@@ -126,7 +126,7 @@ const hasLanguageSwitcher = site.header.links.some(
126
126
  >
127
127
  <div class="ss-header__dialog-top site-shell">
128
128
  <a class="ss-header__dialog-brand" href={contentHref('/', site)}>
129
- <BrandLogo name={site.name} />
129
+ <BrandLogo site={site} />
130
130
  </a>
131
131
  <button
132
132
  type="button"
@@ -1,5 +1,7 @@
1
1
  @layer components {
2
2
  .ss-header {
3
+ --ss-logo-light-visibility: hidden;
4
+ --ss-logo-dark-visibility: visible;
3
5
  --ss-header-active-underline: var(--color-hero-cyan);
4
6
  --ss-header-cta-outline: var(--color-primary-content);
5
7
  --ss-header-dropdown-bg: var(--color-hero-navy);
@@ -80,6 +82,8 @@
80
82
  }
81
83
  }
82
84
  &.ss-header--scrolled {
85
+ --ss-logo-light-visibility: visible;
86
+ --ss-logo-dark-visibility: hidden;
83
87
  --ss-header-active-underline: currentColor;
84
88
  --ss-header-cta-outline: var(--color-base-content);
85
89
  --ss-header-dropdown-bg: var(--color-base-100);
@@ -125,6 +129,8 @@
125
129
  }
126
130
 
127
131
  .ss-header__dialog {
132
+ --ss-logo-light-visibility: hidden;
133
+ --ss-logo-dark-visibility: visible;
128
134
  --ss-brand-highlight: var(--color-hero-cyan);
129
135
  --ss-header-active-underline: var(--color-hero-cyan);
130
136
  --ss-header-cta-outline: var(--color-primary-content);
@@ -266,7 +272,7 @@
266
272
  font-size: 1.25rem;
267
273
  gap: 0.5rem;
268
274
  }
269
- .ss-brand-logo img {
275
+ .ss-brand-logo:not(.ss-brand-logo--custom) img {
270
276
  width: 2rem;
271
277
  height: 2rem;
272
278
  }
@@ -5,13 +5,7 @@ import { t } from '../../i18n/index.js';
5
5
  import Footer from '../../components/organisms/Footer/Footer.astro';
6
6
  import type { SiteConfig } from '../../../../lib/sproutsite/types.js';
7
7
  import { canonicalUrl, withBase } from '../../../../lib/sproutsite/urls.js';
8
- import favicon from '../../assets/branding/favicon.svg?url&no-inline';
9
- import faviconIco from '../../assets/branding/favicon.ico?url&no-inline';
10
- import favicon16 from '../../assets/branding/favicon-16x16.png';
11
- import favicon32 from '../../assets/branding/favicon-32x32.png';
12
- import favicon48 from '../../assets/branding/favicon-48x48.png';
13
- import appleIcon from '../../assets/branding/apple-touch-icon.png';
14
- import socialCard from '../../assets/branding/social-card.png';
8
+ import { resolveBranding } from '../../branding.js';
15
9
  interface Props {
16
10
  site: SiteConfig;
17
11
  title: string;
@@ -32,8 +26,8 @@ const documentTitle = `${title} | ${site.name}`;
32
26
  const canonical = noindex
33
27
  ? new URL(withBase(route, site.base), site.url).href
34
28
  : canonicalUrl(route, site);
35
- const productSite = site.name === 'Sproutsite';
36
- const socialImage = new URL(socialCard.src, site.url).href;
29
+ const branding = await resolveBranding(site);
30
+ const socialImage = branding.sharingImage;
37
31
  ---
38
32
 
39
33
  <!doctype html>
@@ -50,47 +44,44 @@ const socialImage = new URL(socialCard.src, site.url).href;
50
44
  type="application/xml"
51
45
  href={withBase('/sitemap.xml', site.base)}
52
46
  />
53
- <link rel="icon" type="image/svg+xml" href={favicon} />
54
47
  <link
55
48
  rel="icon"
56
- type="image/x-icon"
57
- sizes="16x16 32x32 48x48"
58
- href={faviconIco}
49
+ type={branding.favicon.type}
50
+ href={branding.favicon.src}
51
+ />
52
+ {branding.shortcut && (
53
+ <link rel="icon" type="image/x-icon" href={branding.shortcut} />
54
+ )}
55
+ <link
56
+ rel="apple-touch-icon"
57
+ sizes="180x180"
58
+ href={branding.appleTouch}
59
59
  />
60
- {[favicon16, favicon32, favicon48].map((icon) => (
61
- <link
62
- rel="icon"
63
- type="image/png"
64
- sizes={`${icon.width}x${icon.height}`}
65
- href={icon.src}
66
- />
67
- ))}
68
- <link rel="apple-touch-icon" sizes="180x180" href={appleIcon.src} />
69
60
  <link rel="manifest" href={withBase('/site.webmanifest', site.base)} />
70
61
  <meta property="og:title" content={documentTitle} />
71
62
  <meta property="og:description" content={description} />
72
63
  <meta property="og:url" content={canonical} />
73
64
  <meta property="og:site_name" content={site.name} />
74
65
  <meta property="og:type" content="website" />
75
- {productSite && (
66
+ {socialImage && (
76
67
  <>
77
- <meta property="og:image" content={socialImage} />
78
- <meta property="og:image:width" content="1200" />
79
- <meta property="og:image:height" content="630" />
68
+ <meta property="og:image" content={socialImage.src} />
80
69
  <meta
81
- property="og:image:alt"
82
- content="Sproutsite — The Agent-Ready Static CMS"
70
+ property="og:image:width"
71
+ content={String(socialImage.width)}
83
72
  />
84
- <meta name="twitter:image" content={socialImage} />
85
73
  <meta
86
- name="twitter:image:alt"
87
- content="Sproutsite — The Agent-Ready Static CMS"
74
+ property="og:image:height"
75
+ content={String(socialImage.height)}
88
76
  />
77
+ <meta property="og:image:alt" content={socialImage.alt} />
78
+ <meta name="twitter:image" content={socialImage.src} />
79
+ <meta name="twitter:image:alt" content={socialImage.alt} />
89
80
  </>
90
81
  )}
91
82
  <meta
92
83
  name="twitter:card"
93
- content={productSite ? 'summary_large_image' : 'summary'}
84
+ content={socialImage ? 'summary_large_image' : 'summary'}
94
85
  />
95
86
  <meta name="twitter:title" content={documentTitle} />
96
87
  <meta name="twitter:description" content={description} />