sproutsite 0.5.24 → 0.5.25

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 (32) hide show
  1. package/README.md +11 -6
  2. package/THIRD_PARTY_NOTICES.md +3 -3
  3. package/VERSION +1 -1
  4. package/package.json +1 -1
  5. package/src/lib/sproutsite/branding.ts +7 -45
  6. package/src/lib/sproutsite/hero-background.ts +61 -0
  7. package/src/lib/sproutsite/public-assets.ts +33 -0
  8. package/src/lib/sproutsite/remark-links.ts +4 -3
  9. package/src/lib/sproutsite/site-config.ts +209 -38
  10. package/src/lib/sproutsite/sitemap.ts +2 -2
  11. package/src/lib/sproutsite/types.ts +5 -9
  12. package/src/lib/sproutsite/urls.ts +3 -3
  13. package/src/lib/sproutsite/validation.ts +4 -1
  14. package/src/package/config.ts +17 -9
  15. package/src/package/content.ts +25 -1
  16. package/src/package/manifest.ts +1 -1
  17. package/src/package/page.astro +6 -3
  18. package/src/package/starter-assets/README.md +6 -3
  19. package/src/themes/default/components/atoms/HeroBackground/HeroBackground.astro +52 -0
  20. package/src/themes/default/components/atoms/HeroBackground/HeroBackground.css +23 -0
  21. package/src/themes/default/components/molecules/LanguageSwitcher/LanguageSwitcher.astro +8 -5
  22. package/src/themes/default/components/organisms/BlogIndex/BlogIndex.astro +16 -13
  23. package/src/themes/default/components/organisms/BlogPost/BlogPost.astro +1 -1
  24. package/src/themes/default/components/organisms/Footer/Footer.astro +1 -1
  25. package/src/themes/default/components/organisms/Header/Header.astro +2 -2
  26. package/src/themes/default/components/organisms/Hero/Hero.astro +12 -13
  27. package/src/themes/default/components/organisms/Hero/Hero.css +7 -18
  28. package/src/themes/default/components/organisms/PageTitle/PageTitle.astro +19 -0
  29. package/src/themes/default/layouts/ErrorPage/ErrorPage.astro +7 -6
  30. package/src/themes/default/layouts/PageLayout/PageLayout.astro +3 -3
  31. package/src/themes/default/styles/theme.css +1 -0
  32. package/src/themes/default/assets/hero-waves.svg +0 -41
@@ -40,9 +40,9 @@ export function withBase(pathname: string, base: string): string {
40
40
 
41
41
  export function contentHref(href: string, site: SiteConfig): string {
42
42
  if (!href.startsWith('/') || href.startsWith('//')) return href;
43
- const defaultLocale = site.locales[0];
43
+ const defaultLocale = site.i18n.defaultLocale;
44
44
  const localePrefix =
45
- site.language === defaultLocale ? '' : `/${site.language}`;
45
+ site.i18n.locale === defaultLocale ? '' : `/${site.i18n.locale}`;
46
46
  const localizedHref =
47
47
  localePrefix === '' ||
48
48
  href === localePrefix ||
@@ -89,7 +89,7 @@ export function externalLinkAttributes(
89
89
  if (!isExternalWebLink(href, site.url)) return {};
90
90
  return {
91
91
  'data-external-link': '',
92
- ...(site.links?.externalNewTab !== false
92
+ ...(site.links?.external?.newTab !== false
93
93
  ? { target: '_blank' as const, rel: 'noopener noreferrer' }
94
94
  : {}),
95
95
  };
@@ -13,6 +13,7 @@ import { visit } from 'unist-util-visit';
13
13
  import { loadSiteConfig } from './site-config.js';
14
14
  import { heroTypes, sectionSpacings, tones } from './types.js';
15
15
  import { isHexColor } from './colors.js';
16
+ import { validateHeroBackground } from './hero-background.js';
16
17
  import {
17
18
  badgeVariants,
18
19
  badgeStyles,
@@ -78,7 +79,7 @@ const heroSchema = markdownSchema
78
79
  })
79
80
  .optional(),
80
81
  classes: z.array(heroClass).max(8).nullable().optional(),
81
- 'background-image': z.string().trim().min(1).optional(),
82
+ 'background-image': z.string().trim().min(1).nullable().optional(),
82
83
  actions: z.array(heroAction).min(1).max(2).optional(),
83
84
  claim: z.string().trim().min(1).optional(),
84
85
  tagline: z.string().trim().min(1).optional(),
@@ -1366,6 +1367,8 @@ export function validateSproutsiteContent(
1366
1367
  );
1367
1368
  if (filename === 'hero.md') {
1368
1369
  const heroMetadata = heroSchema.parse(frontmatter);
1370
+ if (heroMetadata['background-image']?.startsWith('/'))
1371
+ validateHeroBackground(heroMetadata['background-image'], path);
1369
1372
  for (const action of heroMetadata.actions ?? []) {
1370
1373
  if (
1371
1374
  /^(?:javascript:|data:)/i.test(action.href) ||
@@ -18,6 +18,7 @@ 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
20
  import { validateBrandingImages } from '../lib/sproutsite/branding.js';
21
+ import { validateHeroBackgroundImage } from '../lib/sproutsite/hero-background.js';
21
22
 
22
23
  /** Returns the Astro configuration required by the default Sproutsite theme. */
23
24
  export function createSproutsiteConfig() {
@@ -29,8 +30,8 @@ export function createSproutsiteConfig() {
29
30
  site: site.url,
30
31
  base: site.base,
31
32
  i18n: {
32
- locales: site.locales,
33
- defaultLocale: site.language,
33
+ locales: site.i18n.locales,
34
+ defaultLocale: site.i18n.defaultLocale,
34
35
  routing: { prefixDefaultLocale: false },
35
36
  },
36
37
  integrations: [
@@ -60,9 +61,15 @@ export function createSproutsiteConfig() {
60
61
  name: 'sproutsite/default-routes',
61
62
  hooks: {
62
63
  'astro:config:setup': async ({ injectRoute }) => {
63
- for (const locale of site.locales) {
64
+ for (const locale of site.i18n.locales) {
65
+ await validateHeroBackgroundImage(
66
+ (locale === site.i18n.defaultLocale
67
+ ? site
68
+ : loadSiteConfig(locale)
69
+ ).hero['background-image'],
70
+ );
64
71
  await validateBrandingImages(
65
- (locale === site.language
72
+ (locale === site.i18n.defaultLocale
66
73
  ? site
67
74
  : loadSiteConfig(locale)
68
75
  ).branding,
@@ -78,8 +85,8 @@ export function createSproutsiteConfig() {
78
85
  entrypoint: new URL('./500.astro', import.meta.url),
79
86
  prerender: true,
80
87
  });
81
- for (const locale of site.locales.filter(
82
- (locale) => locale !== site.language,
88
+ for (const locale of site.i18n.locales.filter(
89
+ (locale) => locale !== site.i18n.defaultLocale,
83
90
  )) {
84
91
  for (const status of [404, 500]) {
85
92
  injectRoute({
@@ -115,8 +122,8 @@ export function createSproutsiteConfig() {
115
122
  );
116
123
  // Astro owns error-page rendering. Flatten localized output
117
124
  // for web servers that select their error documents by locale.
118
- for (const locale of site.locales.filter(
119
- (locale) => locale !== site.language,
125
+ for (const locale of site.i18n.locales.filter(
126
+ (locale) => locale !== site.i18n.defaultLocale,
120
127
  )) {
121
128
  for (const status of [404, 500]) {
122
129
  const flat = new URL(
@@ -166,7 +173,8 @@ export function createSproutsiteConfig() {
166
173
  rehypeExternalLinks,
167
174
  {
168
175
  url: site.url,
169
- externalNewTab: site.links?.externalNewTab ?? true,
176
+ externalNewTab:
177
+ site.links?.external?.newTab ?? true,
170
178
  },
171
179
  ],
172
180
  ],
@@ -2,6 +2,7 @@ import { defineCollection, type ImageFunction } from 'astro:content';
2
2
  import { glob } from 'astro/loaders';
3
3
  import { z } from 'astro/zod';
4
4
  import { heroTypes, sectionSpacings, tones } from '../lib/sproutsite/types.js';
5
+ import { publicHeroImage } from '../lib/sproutsite/hero-background.js';
5
6
  import { optionalBlogLoader } from './optional-blog-loader.js';
6
7
  import { createBlogReadinessLoader } from './blog-state.js';
7
8
 
@@ -80,7 +81,30 @@ export function createSproutsiteCollections(
80
81
  titleHighlight: z.string().trim().min(1).optional(),
81
82
  eyebrow: z.string().trim().min(1).optional(),
82
83
  classes: z.array(heroClass).max(8).nullable().optional(),
83
- 'background-image': image().optional(),
84
+ 'background-image': z
85
+ .union([
86
+ z
87
+ .string()
88
+ .refine(
89
+ (src) => publicHeroImage.safeParse(src).success,
90
+ 'must be a public image path',
91
+ ),
92
+ z.preprocess((value, context) => {
93
+ if (
94
+ typeof value !== 'string' ||
95
+ !(value.startsWith('./') || value.startsWith('../'))
96
+ ) {
97
+ context.addIssue({
98
+ code: 'custom',
99
+ message: 'must be a relative local image path',
100
+ });
101
+ return z.NEVER;
102
+ }
103
+ return value;
104
+ }, image()),
105
+ ])
106
+ .nullable()
107
+ .optional(),
84
108
  actions: z.array(heroAction).min(1).max(2).optional(),
85
109
  claim: z.string().trim().min(1).optional(),
86
110
  tagline: z.string().trim().min(1).optional(),
@@ -11,7 +11,7 @@ export const GET: APIRoute = async () => {
11
11
  JSON.stringify({
12
12
  name: site.name,
13
13
  short_name: site.name,
14
- lang: site.language,
14
+ lang: site.i18n.locale,
15
15
  start_url: site.base,
16
16
  scope: site.base,
17
17
  display: 'browser',
@@ -16,8 +16,10 @@ type Locale = 'en' | 'de';
16
16
 
17
17
  export { localeOf, logicalId };
18
18
 
19
- export async function getSproutsiteStaticPaths(locale: Locale = 'en') {
20
- if (!loadSiteConfig().locales.includes(locale)) return [];
19
+ export async function getSproutsiteStaticPaths(
20
+ locale: Locale = loadSiteConfig().i18n.defaultLocale as Locale,
21
+ ) {
22
+ if (!loadSiteConfig().i18n.locales.includes(locale)) return [];
21
23
  const pages = assemblePages(
22
24
  (await getCollection('pages')).filter(
23
25
  (entry) => localeOf(entry.id) === locale,
@@ -105,8 +107,9 @@ const postSections = post
105
107
  <Hero hero={page.hero!} site={site} Content={hero.Content} />
106
108
  ) : page.entry.data.layout !== 'landing' ? (
107
109
  <PageTitle
110
+ site={site}
108
111
  title={page.entry.data.title}
109
- classes={site.heroClasses}
112
+ classes={site.hero.classes}
110
113
  />
111
114
  ) : null}
112
115
  {sections.map(({ section, rendered }) => (
@@ -35,9 +35,12 @@ Manifest schema version 1 contains:
35
35
  image files.
36
36
  - `heroExample`: an optional existing-API integration. Copy its `source` to
37
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.
38
+ same local asset for both languages. This recipe uses Astro's
39
+ local image schema for optimization. Alternatively set the global
40
+ `hero.background-image` to `/images/hero.jpg` after copying public files;
41
+ public images are delivered unchanged. Set `classes: null` to remove the
42
+ default theme classes. The local image independently replaces any global
43
+ background image.
41
44
 
42
45
  Do not merge a second duplicate `branding` YAML key. Keep the existing name,
43
46
  URL, locale, typography and navigation configuration. Locale files inherit the
@@ -0,0 +1,52 @@
1
+ ---
2
+ import type { ImageMetadata } from 'astro';
3
+ import { Image } from 'astro:assets';
4
+ import { publicImageMetadata } from '../../../../../lib/sproutsite/public-assets.js';
5
+ import {
6
+ validateHeroBackground,
7
+ validateHeroBackgroundImage,
8
+ } from '../../../../../lib/sproutsite/hero-background.js';
9
+ import { withBase } from '../../../../../lib/sproutsite/urls.js';
10
+
11
+ interface Props {
12
+ source: ImageMetadata | string;
13
+ base: string;
14
+ }
15
+ const { source, base } = Astro.props;
16
+ if (typeof source === 'string')
17
+ validateHeroBackground(source, 'hero background');
18
+ if (typeof source === 'string') await validateHeroBackgroundImage(source);
19
+ const image =
20
+ typeof source === 'string'
21
+ ? {
22
+ ...(await publicImageMetadata(source)),
23
+ src: withBase(source, base),
24
+ }
25
+ : source;
26
+ const svg = image.format === 'svg';
27
+ const classes = ['ss-hero-background', { 'ss-hero-background--svg': svg }];
28
+ ---
29
+
30
+ {typeof source === 'string' || svg ? (
31
+ <img
32
+ class:list={classes}
33
+ src={image.src}
34
+ width={image.width}
35
+ height={image.height}
36
+ alt=""
37
+ loading="eager"
38
+ decoding="async"
39
+ aria-hidden="true"
40
+ />
41
+ ) : (
42
+ <Image
43
+ class:list={classes}
44
+ src={source}
45
+ alt=""
46
+ format="webp"
47
+ quality={82}
48
+ loading="eager"
49
+ decoding="async"
50
+ aria-hidden="true"
51
+ />
52
+ )}
@@ -0,0 +1,23 @@
1
+ @layer components {
2
+ .ss-hero-background {
3
+ pointer-events: none;
4
+ position: absolute;
5
+ inset: 0;
6
+ z-index: 0;
7
+ width: 100%;
8
+ height: 100%;
9
+ object-fit: cover;
10
+ object-position: center;
11
+
12
+ &.ss-hero-background--svg {
13
+ object-position: right top;
14
+
15
+ @media (width < 64rem) {
16
+ left: auto;
17
+ width: auto;
18
+ max-width: none;
19
+ opacity: 0.5;
20
+ }
21
+ }
22
+ }
23
+ }
@@ -24,8 +24,8 @@ const flags: Record<string, string> = { en: englishFlag, de: germanFlag };
24
24
  const options = languageLinks(
25
25
  pages,
26
26
  posts,
27
- site.locales,
28
- site.language,
27
+ site.i18n.locales,
28
+ site.i18n.locale,
29
29
  route,
30
30
  ).map((option) => ({
31
31
  ...option,
@@ -35,7 +35,7 @@ const options = languageLinks(
35
35
  ) ?? option.locale,
36
36
  flag: flags[option.locale],
37
37
  href:
38
- site.locales.length > 1
38
+ site.i18n.locales.length > 1
39
39
  ? getRelativeLocaleUrl(option.locale, option.route.slice(1))
40
40
  : withBase(option.route, site.base),
41
41
  }));
@@ -48,14 +48,17 @@ const options = languageLinks(
48
48
  ]}
49
49
  >
50
50
  <summary
51
- aria-label={t(site.language === 'de' ? 'de' : 'en', 'languageSwitcher')}
51
+ aria-label={t(
52
+ site.i18n.locale === 'de' ? 'de' : 'en',
53
+ 'languageSwitcher',
54
+ )}
52
55
  >
53
56
  <Icon
54
57
  name="Globe"
55
58
  size={20}
56
59
  strokeWidth={placement === 'footer' ? 1.5 : 2}
57
60
  />
58
- <span>{site.language.toUpperCase()}</span>
61
+ <span>{site.i18n.locale.toUpperCase()}</span>
59
62
  <Icon name="ChevronDown" size={16} />
60
63
  </summary>
61
64
  <ul class="ss-language-switcher__options">
@@ -17,14 +17,16 @@ interface Props {
17
17
  }
18
18
 
19
19
  const { posts, site } = Astro.props;
20
- const locale = site.language === 'de' ? 'de' : 'en';
20
+ const locale = site.i18n.locale === 'de' ? 'de' : 'en';
21
21
  const blog = site.blog ?? {
22
- title: 'Blog',
23
- description: t(locale, 'blogDescription'),
24
- eyebrow: t(locale, 'blogEyebrow'),
25
- heading: t(locale, 'blogHeading'),
22
+ hero: {
23
+ title: 'Blog',
24
+ description: t(locale, 'blogDescription'),
25
+ eyebrow: t(locale, 'blogEyebrow'),
26
+ },
27
+ articles: { heading: t(locale, 'blogHeading') },
26
28
  };
27
- const dateFormatter = new Intl.DateTimeFormat(site.language, {
29
+ const dateFormatter = new Intl.DateTimeFormat(site.i18n.locale, {
28
30
  day: '2-digit',
29
31
  month: 'long',
30
32
  year: 'numeric',
@@ -34,15 +36,16 @@ const dateFormatter = new Intl.DateTimeFormat(site.language, {
34
36
 
35
37
  <PageLayout
36
38
  site={site}
37
- title={blog.title}
38
- description={blog.description}
39
+ title={blog.hero.title}
40
+ description={blog.hero.description}
39
41
  route="/blog/"
40
42
  >
41
43
  <PageTitle
42
- title={blog.title}
43
- eyebrow={blog.eyebrow}
44
- description={blog.description}
45
- classes={site.heroClasses}
44
+ site={site}
45
+ title={blog.hero.title}
46
+ eyebrow={blog.hero.eyebrow}
47
+ description={blog.hero.description}
48
+ classes={site.hero.classes}
46
49
  variant="hero"
47
50
  />
48
51
  <section
@@ -51,7 +54,7 @@ const dateFormatter = new Intl.DateTimeFormat(site.language, {
51
54
  >
52
55
  <div class="ss-section__inner site-shell">
53
56
  <div class="content-prose ss-blog-index__content">
54
- <h2 id="blog-overview">{blog.heading}</h2>
57
+ <h2 id="blog-overview">{blog.articles.heading}</h2>
55
58
  <div class="ss-blog-index__grid">
56
59
  {posts.map((post) => (
57
60
  <Card
@@ -20,7 +20,7 @@ interface Props {
20
20
  }
21
21
 
22
22
  const { post, site, HeroContent, sections } = Astro.props;
23
- const dateFormatter = new Intl.DateTimeFormat(site.language, {
23
+ const dateFormatter = new Intl.DateTimeFormat(site.i18n.locale, {
24
24
  day: '2-digit',
25
25
  month: 'long',
26
26
  year: 'numeric',
@@ -16,7 +16,7 @@ interface Props {
16
16
  route: string;
17
17
  }
18
18
  const { site, route } = Astro.props;
19
- const language = site.language === 'de' ? 'de' : 'en';
19
+ const language = site.i18n.locale === 'de' ? 'de' : 'en';
20
20
  const socialIcons = {
21
21
  github: siGithub,
22
22
  instagram: siInstagram,
@@ -17,7 +17,7 @@ interface Props {
17
17
  route: string;
18
18
  }
19
19
  const { site, route } = Astro.props;
20
- const language = site.language === 'de' ? 'de' : 'en';
20
+ const language = site.i18n.locale === 'de' ? 'de' : 'en';
21
21
  const hasLanguageSwitcher = site.header.links.some(
22
22
  (link) => link.type === 'language-switcher',
23
23
  );
@@ -51,7 +51,7 @@ const hasLanguageSwitcher = site.header.links.some(
51
51
  <nav
52
52
  class="ss-header__nav"
53
53
  aria-label={t(
54
- site.language === 'de' ? 'de' : 'en',
54
+ site.i18n.locale === 'de' ? 'de' : 'en',
55
55
  'primaryNavigation',
56
56
  )}
57
57
  >
@@ -1,6 +1,10 @@
1
1
  ---
2
2
  import type { CollectionEntry } from 'astro:content';
3
- import { Image } from 'astro:assets';
3
+ import HeroBackground from '../../atoms/HeroBackground/HeroBackground.astro';
4
+ import {
5
+ selectHeroBackground,
6
+ isSvgHeroImage,
7
+ } from '../../../../../lib/sproutsite/hero-background.js';
4
8
  import { toneOf } from '../../../../../lib/sproutsite/pages.js';
5
9
  import type { SiteConfig } from '../../../../../lib/sproutsite/types.js';
6
10
  import Button from '../../atoms/Button/Button.astro';
@@ -21,9 +25,12 @@ const toneClass = {
21
25
  }[toneOf(hero)];
22
26
  const heroClasses =
23
27
  hero.data.classes === undefined
24
- ? site.heroClasses
28
+ ? site.hero.classes
25
29
  : (hero.data.classes ?? []);
26
- const backgroundImage = hero.data['background-image'];
30
+ const backgroundImage = selectHeroBackground(
31
+ hero.data['background-image'],
32
+ site.hero['background-image'],
33
+ );
27
34
  const heroTitle = hero.data.title;
28
35
  if (!heroTitle) throw new Error('Sproutsite Hero requires a title.');
29
36
  const titleHighlight = hero.data.titleHighlight;
@@ -47,21 +54,13 @@ const titleLines = heroTitle.split('\n').map((line) => {
47
54
  'ss-hero',
48
55
  `ss-hero--${hero.data.type ?? 'small'}`,
49
56
  { 'ss-hero--has-background-image': Boolean(backgroundImage) },
57
+ { 'ss-hero--background-svg': isSvgHeroImage(backgroundImage) },
50
58
  ...heroClasses,
51
59
  ]}
52
60
  aria-labelledby="page-title"
53
61
  >
54
62
  {backgroundImage && (
55
- <Image
56
- class="ss-hero__background"
57
- src={backgroundImage}
58
- alt=""
59
- format="webp"
60
- quality={82}
61
- loading="eager"
62
- decoding="async"
63
- aria-hidden="true"
64
- />
63
+ <HeroBackground source={backgroundImage} base={site.base} />
65
64
  )}
66
65
  <div class="ss-hero__inner site-shell">
67
66
  {hero.data.eyebrow && <Eyebrow>{hero.data.eyebrow}</Eyebrow>}
@@ -101,14 +101,11 @@
101
101
  }
102
102
  }
103
103
 
104
- .ss-hero__background {
105
- @apply pointer-events-none absolute inset-0 z-0 size-full object-cover object-center;
106
- }
107
-
108
104
  &.ss-hero--has-background-image {
109
105
  @apply text-primary-content;
110
106
 
111
- &::before {
107
+ &:not(.ss-hero--background-svg)::before,
108
+ &.ss-hero--background-svg:not(.ss-hero--theme-1)::before {
112
109
  content: '';
113
110
  @apply pointer-events-none absolute inset-0 z-[1];
114
111
  background:
@@ -143,7 +140,7 @@
143
140
 
144
141
  &::before {
145
142
  content: '';
146
- @apply pointer-events-none absolute inset-0;
143
+ @apply pointer-events-none absolute inset-0 z-[1];
147
144
  background-image:
148
145
  linear-gradient(
149
146
  90deg,
@@ -160,27 +157,19 @@
160
157
  color-mix(in srgb, var(--color-hero-navy) 35%, transparent)
161
158
  5rem,
162
159
  transparent 10rem
163
- ),
164
- url('../../../assets/hero-waves.svg');
165
- /* Fill wide heroes proportionally so the lower blue contours
166
- * reach the middle; bottom alignment preserves their layering. */
160
+ );
167
161
  background-size: cover;
168
162
  background-position:
169
163
  right bottom,
170
- right bottom,
171
- right top;
164
+ right bottom;
172
165
  background-repeat: no-repeat;
173
166
  }
174
167
 
175
- /* Keep waves quiet behind the wider text and wrapping navigation on
176
- * tablets and phones; preserve the full SVG height to avoid seams. */
168
+ /* Keep the overlay subtle on tablets and phones. SVG sizing lives
169
+ * in the shared HeroBackground atom, independently of this class. */
177
170
  @media (max-width: 63.999rem) {
178
171
  &::before {
179
172
  opacity: 0.5;
180
- background-size:
181
- cover,
182
- cover,
183
- auto 100%;
184
173
  }
185
174
  }
186
175
  }
@@ -1,8 +1,12 @@
1
1
  ---
2
2
  import Eyebrow from '../../atoms/Eyebrow/Eyebrow.astro';
3
+ import HeroBackground from '../../atoms/HeroBackground/HeroBackground.astro';
4
+ import type { SiteConfig } from '../../../../../lib/sproutsite/types.js';
5
+ import { isSvgHeroImage } from '../../../../../lib/sproutsite/hero-background.js';
3
6
 
4
7
  interface Props {
5
8
  title: string;
9
+ site: SiteConfig;
6
10
  classes: string[];
7
11
  eyebrow?: string;
8
12
  description?: string;
@@ -11,6 +15,7 @@ interface Props {
11
15
 
12
16
  const {
13
17
  title,
18
+ site,
14
19
  classes,
15
20
  eyebrow,
16
21
  description,
@@ -25,10 +30,24 @@ const {
25
30
  'ss-hero--small',
26
31
  'ss-page-title',
27
32
  `ss-page-title--${variant}`,
33
+ {
34
+ 'ss-hero--has-background-image': Boolean(
35
+ site.hero['background-image'],
36
+ ),
37
+ 'ss-hero--background-svg': isSvgHeroImage(
38
+ site.hero['background-image'],
39
+ ),
40
+ },
28
41
  ...classes,
29
42
  ]}
30
43
  aria-labelledby="page-title"
31
44
  >
45
+ {site.hero['background-image'] && (
46
+ <HeroBackground
47
+ source={site.hero['background-image']}
48
+ base={site.base}
49
+ />
50
+ )}
32
51
  <div class="ss-hero__inner ss-page-title__inner site-shell">
33
52
  {eyebrow && <Eyebrow>{eyebrow}</Eyebrow>}
34
53
  <h1 id="page-title" class="ss-hero__title ss-page-title__title">
@@ -10,11 +10,12 @@ interface Props {
10
10
  }
11
11
  const { status } = Astro.props;
12
12
  const defaultSite = loadSiteConfig();
13
- const german =
14
- defaultSite.locales.includes('de') &&
15
- (Astro.url.pathname.startsWith(`${defaultSite.base}de/`) ||
16
- defaultSite.language === 'de');
17
- const site = german ? loadSiteConfig('de') : defaultSite;
13
+ const locale =
14
+ defaultSite.i18n.locales.find((candidate) =>
15
+ Astro.url.pathname.startsWith(`${defaultSite.base}${candidate}/`),
16
+ ) ?? defaultSite.i18n.defaultLocale;
17
+ const site = loadSiteConfig(locale);
18
+ const german = site.i18n.locale === 'de';
18
19
  const introduction = german
19
20
  ? status === 404
20
21
  ? 'Diese Adresse führt gerade ins Grüne.'
@@ -70,7 +71,7 @@ const copy = german
70
71
  site={site}
71
72
  title={copy.eyebrow}
72
73
  description={copy.description}
73
- route={`/${status}${site.language === defaultSite.language ? '' : `-${site.language}`}.html`}
74
+ route={`/${status}${site.i18n.locale === defaultSite.i18n.defaultLocale ? '' : `-${site.i18n.locale}`}.html`}
74
75
  noindex
75
76
  >
76
77
  <Hero
@@ -31,7 +31,7 @@ const socialImage = branding.sharingImage;
31
31
  ---
32
32
 
33
33
  <!doctype html>
34
- <html lang={site.language} data-theme="sproutsite">
34
+ <html lang={site.i18n.locale} data-theme="sproutsite">
35
35
  <head>
36
36
  <meta charset="utf-8" />
37
37
  <meta name="viewport" content="width=device-width, initial-scale=1" />
@@ -95,11 +95,11 @@ const socialImage = branding.sharingImage;
95
95
  }}
96
96
  class:list={{
97
97
  'ss-page--landing': layout === 'landing',
98
- 'ss-links--external-icons': site.links?.externalIcon === true,
98
+ 'ss-links--external-icons': site.links?.external?.icon === true,
99
99
  }}
100
100
  >
101
101
  <a class="ss-skip-link" href="#main-content">
102
- {t(site.language === 'de' ? 'de' : 'en', 'skipToContent')}
102
+ {t(site.i18n.locale === 'de' ? 'de' : 'en', 'skipToContent')}
103
103
  </a>
104
104
  {layout !== 'landing' && <Header site={site} route={route} />}
105
105
  <main id="main-content">
@@ -25,6 +25,7 @@
25
25
 
26
26
  /* Theme components: atoms, molecules, organisms, then layout primitives */
27
27
  @import '../components/atoms/BrandLogo/BrandLogo.css';
28
+ @import '../components/atoms/HeroBackground/HeroBackground.css';
28
29
  @import '../components/atoms/Badge/Badge.css';
29
30
  @import '../components/atoms/Button/Button.css';
30
31
  @import '../components/atoms/ContentImage/ContentImage.css';