maverick-wave-astro 1.0.0
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.
- package/README.md +83 -0
- package/bin/check.mjs +53 -0
- package/components/Accordion.astro +47 -0
- package/components/Address.astro +36 -0
- package/components/Announcement.astro +27 -0
- package/components/Avatar.astro +34 -0
- package/components/BaseLayout.astro +142 -0
- package/components/BlogPost.astro +144 -0
- package/components/Breadcrumbs.astro +69 -0
- package/components/Calendar.astro +104 -0
- package/components/CalendarLegend.astro +34 -0
- package/components/ComingSoon.astro +21 -0
- package/components/DateStamp.astro +24 -0
- package/components/EmptyState.astro +24 -0
- package/components/Favicons.astro +42 -0
- package/components/Feed.astro +85 -0
- package/components/Footer.astro +162 -0
- package/components/Gallery.astro +55 -0
- package/components/Header.astro +107 -0
- package/components/Hero.astro +158 -0
- package/components/Icon.astro +27 -0
- package/components/IconCard.astro +36 -0
- package/components/ImageSlider.astro +64 -0
- package/components/ImprintCard.astro +52 -0
- package/components/JsonLd.astro +11 -0
- package/components/LanguageSwitch.astro +53 -0
- package/components/LegalPage.astro +19 -0
- package/components/Media.astro +40 -0
- package/components/MetaInfo.astro +24 -0
- package/components/Modal.astro +47 -0
- package/components/Mosaic.astro +38 -0
- package/components/NotFound.astro +34 -0
- package/components/Offer.astro +79 -0
- package/components/OpeningHours.astro +14 -0
- package/components/PageHeader.astro +38 -0
- package/components/Picture.astro +50 -0
- package/components/PortraitGallery.astro +68 -0
- package/components/PostalAddress.astro +20 -0
- package/components/Price.astro +84 -0
- package/components/PrivacyCard.astro +65 -0
- package/components/Progress.astro +53 -0
- package/components/PromoBar.astro +25 -0
- package/components/Schedule.astro +60 -0
- package/components/SectionHead.astro +18 -0
- package/components/SocialLinks.astro +47 -0
- package/components/Stepper.astro +76 -0
- package/components/Stories.astro +80 -0
- package/components/TabPanel.astro +15 -0
- package/components/Table.astro +115 -0
- package/components/Tabs.astro +38 -0
- package/components/Testimonial.astro +61 -0
- package/components/ThemeToggle.astro +30 -0
- package/components/Tiles.astro +63 -0
- package/components/Timeline.astro +64 -0
- package/components/ValueList.astro +42 -0
- package/config/eslint.js +58 -0
- package/config/prettier.mjs +30 -0
- package/dist/config.d.ts +3 -0
- package/dist/config.js +6 -0
- package/dist/contact.d.ts +2 -0
- package/dist/contact.js +8 -0
- package/dist/date.d.ts +26 -0
- package/dist/date.js +72 -0
- package/dist/design.d.ts +166 -0
- package/dist/design.js +175 -0
- package/dist/icons.d.ts +13 -0
- package/dist/icons.js +15 -0
- package/dist/image-size.d.ts +10 -0
- package/dist/image-size.js +70 -0
- package/dist/integration.d.ts +13 -0
- package/dist/integration.js +90 -0
- package/dist/path.d.ts +1 -0
- package/dist/path.js +5 -0
- package/dist/schedule.d.ts +30 -0
- package/dist/schedule.js +117 -0
- package/dist/social.d.ts +35 -0
- package/dist/social.js +37 -0
- package/dist/structured-data.d.ts +1 -0
- package/dist/structured-data.js +2 -0
- package/dist/text.d.ts +3 -0
- package/dist/text.js +30 -0
- package/dist/types.d.ts +35 -0
- package/dist/types.js +1 -0
- package/dist/uploads.d.ts +7 -0
- package/dist/uploads.js +64 -0
- package/package.json +75 -0
- package/routes/design.css.ts +7 -0
- package/routes/theme.js.ts +28 -0
- package/routes/virtual.d.ts +6 -0
- package/schemas/design.schema.json +214 -0
- package/schemas/promo.schema.json +37 -0
- package/styles/schedule.css +17 -0
- package/styles/table.css +8 -0
- package/styles/theme-toggle.css +13 -0
package/README.md
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# maverick-wave-astro
|
|
2
|
+
|
|
3
|
+
Shared frame for the Astro homepages built with
|
|
4
|
+
[MaverickWave](https://maverick-wave.m1well.com). A site keeps its `site.ts`,
|
|
5
|
+
its content and what is truly its own.
|
|
6
|
+
|
|
7
|
+
## Setup
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install maverick-wave-astro maverick-wave astro
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
```js
|
|
14
|
+
// astro.config.mjs
|
|
15
|
+
import homepage from "maverick-wave-astro";
|
|
16
|
+
import { OG_IMAGE, SITE } from "./src/config/site.ts";
|
|
17
|
+
|
|
18
|
+
export default defineConfig({
|
|
19
|
+
site: "https://example.de",
|
|
20
|
+
integrations: [homepage({ site: SITE, ogImage: OG_IMAGE })],
|
|
21
|
+
});
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
The integration sets the CSP-safe build options, the `@` alias, the sitemap,
|
|
25
|
+
`/design.css`, `/theme.js` and the MaverickWave script. `site.ts` is typed with
|
|
26
|
+
`satisfies Site` (`src/types.ts`). Colours and fonts stay in the site's
|
|
27
|
+
`main.scss`.
|
|
28
|
+
|
|
29
|
+
## Design
|
|
30
|
+
|
|
31
|
+
`design` in `site.ts` takes the semantic values from `src/design.ts`, e.g.
|
|
32
|
+
`{ corners: 'even', buttonShape: 'pill', spacing: 'airy' }`, or the text from
|
|
33
|
+
the setup box of the MaverickWave overlay. `src/content/design.json` overrides
|
|
34
|
+
it value by value - that is the file customers edit in the contentmanager.
|
|
35
|
+
|
|
36
|
+
## Layout
|
|
37
|
+
|
|
38
|
+
The site wraps `BaseLayout` once and imports its stylesheet there:
|
|
39
|
+
|
|
40
|
+
```astro
|
|
41
|
+
<Frame {...Astro.props}>
|
|
42
|
+
<slot name="head" slot="head" />
|
|
43
|
+
<slot name="header" slot="header" />
|
|
44
|
+
<slot />
|
|
45
|
+
<slot name="footer" slot="footer" />
|
|
46
|
+
<Scripts slot="scripts" />
|
|
47
|
+
</Frame>
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Slot `banner` sits below the header; `htmlData` puts `data-*` on `<html>`.
|
|
51
|
+
|
|
52
|
+
## Components
|
|
53
|
+
|
|
54
|
+
- Frame: `Header`, `Footer` (social links, notes, legal links, credit),
|
|
55
|
+
`ThemeToggle`, `LanguageSwitch`, `Announcement`, `PromoBar`
|
|
56
|
+
- Sections: `Hero` (`variant` start | fade), `SectionHead`, `IconCard`,
|
|
57
|
+
`ValueList`, `OpeningHours`, `Address`, `Accordion`, `Calendar`,
|
|
58
|
+
`CalendarLegend`, `EmptyState`
|
|
59
|
+
- Pages: `NotFound`, `LegalPage`, `ImprintCard`, `PrivacyCard`
|
|
60
|
+
- `Schedule` hides expired entries in the browser (`data-expires`,
|
|
61
|
+
`data-starts`, `data-schedule-list`, `data-day`)
|
|
62
|
+
|
|
63
|
+
Helpers live in `src/` and import as `maverick-wave-astro/<file>`.
|
|
64
|
+
|
|
65
|
+
## Contentmanager
|
|
66
|
+
|
|
67
|
+
`contentmanager/sections.json` lists the editable files and their schemas;
|
|
68
|
+
`schemas/design.schema.json` and `schemas/promo.schema.json` ship with the
|
|
69
|
+
package. Put `mwa-check && astro build` in the build script so a broken file
|
|
70
|
+
stops the build - it knows the formats `date`, `email`, `uri` and the keywords
|
|
71
|
+
`x-widget`, `x-item-title`, `x-labels`, `x-empty`, `x-not-before`, `x-groups`.
|
|
72
|
+
Photos uploaded in the contentmanager land in `public/images/uploads/`; the
|
|
73
|
+
integration derives their sizes before the build
|
|
74
|
+
(`maverick-wave-astro/uploads`), skips a file sharp cannot read and removes the
|
|
75
|
+
originals from `dist/`, since they still carry EXIF and GPS. Tooling: re-export
|
|
76
|
+
`maverick-wave-astro/eslint` and `/prettier`.
|
|
77
|
+
|
|
78
|
+
## Releasing
|
|
79
|
+
|
|
80
|
+
- `tools/install-local.sh <site>|--all` packs and installs into sites without
|
|
81
|
+
publishing
|
|
82
|
+
- `./release.sh` publishes the version from `package.json`, then
|
|
83
|
+
`tools/update-all.sh <version>` moves all sites and builds each one
|
package/bin/check.mjs
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Checks every content file from contentmanager/sections.json against its
|
|
3
|
+
// schema before the build - the same check the contentmanager runs on save.
|
|
4
|
+
// Catches hand edits and notices when file and schema drift apart.
|
|
5
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
6
|
+
import path from 'node:path';
|
|
7
|
+
|
|
8
|
+
import Ajv2020 from 'ajv/dist/2020.js';
|
|
9
|
+
import addFormats from 'ajv-formats';
|
|
10
|
+
|
|
11
|
+
const MANIFEST = 'contentmanager/sections.json';
|
|
12
|
+
|
|
13
|
+
const read = file =>
|
|
14
|
+
JSON.parse(readFileSync(path.resolve(process.cwd(), file), 'utf8'));
|
|
15
|
+
|
|
16
|
+
if (!existsSync(MANIFEST)) process.exit(0);
|
|
17
|
+
|
|
18
|
+
const ajv = new Ajv2020({ allErrors: true, verbose: true });
|
|
19
|
+
addFormats(ajv, ['date', 'email', 'uri']);
|
|
20
|
+
ajv.addVocabulary([
|
|
21
|
+
'x-widget',
|
|
22
|
+
'x-item-title',
|
|
23
|
+
'x-labels',
|
|
24
|
+
'x-empty',
|
|
25
|
+
'x-groups',
|
|
26
|
+
]);
|
|
27
|
+
// Same rule as in the contentmanager: YYYY-MM-DD compares as text.
|
|
28
|
+
ajv.addKeyword({
|
|
29
|
+
keyword: 'x-not-before',
|
|
30
|
+
type: 'string',
|
|
31
|
+
schemaType: 'string',
|
|
32
|
+
validate: (sibling, value, _schema, context) => {
|
|
33
|
+
const other = context?.parentData?.[sibling];
|
|
34
|
+
return !other || value >= other;
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
const message = error =>
|
|
39
|
+
error.keyword === 'x-not-before'
|
|
40
|
+
? `is before "${error.schema}"`
|
|
41
|
+
: error.message;
|
|
42
|
+
|
|
43
|
+
let count = 0;
|
|
44
|
+
for (const { file, schema } of read(MANIFEST).sections) {
|
|
45
|
+
const validate = ajv.compile(read(schema));
|
|
46
|
+
if (validate(read(file))) continue;
|
|
47
|
+
for (const error of validate.errors) {
|
|
48
|
+
console.error(`${file}${error.instancePath}: ${message(error)}`);
|
|
49
|
+
count++;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (count > 0) process.exit(1);
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
---
|
|
2
|
+
// Questions and answers. The icon comes as a slot, rendered once and placed in
|
|
3
|
+
// every row - the site decides whether it gets its own wrapper.
|
|
4
|
+
interface Props {
|
|
5
|
+
items: readonly { question: string; answer: string | readonly string[] }[];
|
|
6
|
+
idPrefix: string;
|
|
7
|
+
firstOpen?: boolean;
|
|
8
|
+
class?: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const { items, idPrefix, firstOpen = false, class: className } = Astro.props;
|
|
12
|
+
const icon = await Astro.slots.render('icon');
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
<div class:list={['mw-accordion', className]}>
|
|
16
|
+
{
|
|
17
|
+
items.map((item, index) => {
|
|
18
|
+
const open = firstOpen && index === 0;
|
|
19
|
+
return (
|
|
20
|
+
<div class="mw-accordion-item">
|
|
21
|
+
<button
|
|
22
|
+
type="button"
|
|
23
|
+
class:list={['mw-accordion-header', open && 'mw-active']}
|
|
24
|
+
aria-expanded={open ? 'true' : 'false'}
|
|
25
|
+
aria-controls={`${idPrefix}${index}`}
|
|
26
|
+
>
|
|
27
|
+
<span>{item.question}</span>
|
|
28
|
+
<Fragment set:html={icon} />
|
|
29
|
+
</button>
|
|
30
|
+
<div
|
|
31
|
+
class:list={['mw-accordion-content', open && 'mw-active']}
|
|
32
|
+
id={`${idPrefix}${index}`}
|
|
33
|
+
>
|
|
34
|
+
<div class="mw-accordion-content-inner">
|
|
35
|
+
{(typeof item.answer === 'string'
|
|
36
|
+
? [item.answer]
|
|
37
|
+
: item.answer
|
|
38
|
+
).map(paragraph => (
|
|
39
|
+
<p>{paragraph}</p>
|
|
40
|
+
))}
|
|
41
|
+
</div>
|
|
42
|
+
</div>
|
|
43
|
+
</div>
|
|
44
|
+
);
|
|
45
|
+
})
|
|
46
|
+
}
|
|
47
|
+
</div>
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
---
|
|
2
|
+
// The first line is the name, the rest the address. Below that phone, mail or
|
|
3
|
+
// whatever else the site wants to show as a labelled row.
|
|
4
|
+
interface Props {
|
|
5
|
+
lines: readonly string[];
|
|
6
|
+
contact?: readonly { label: string; href: string; text: string }[];
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const { lines, contact = [] } = Astro.props;
|
|
10
|
+
const [name, ...address] = lines;
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
<address class="mw-contact">
|
|
14
|
+
<p class="mw-text-bold">{name}</p>
|
|
15
|
+
<p>
|
|
16
|
+
{
|
|
17
|
+
address.map((line, index) => (
|
|
18
|
+
<>
|
|
19
|
+
{index > 0 && <br />}
|
|
20
|
+
{line}
|
|
21
|
+
</>
|
|
22
|
+
))
|
|
23
|
+
}
|
|
24
|
+
</p>
|
|
25
|
+
{
|
|
26
|
+
contact.map(entry => (
|
|
27
|
+
<p class="mw-contact-row">
|
|
28
|
+
<span class="mw-contact-label">{entry.label}</span>
|
|
29
|
+
<a class="mw-link" href={entry.href}>
|
|
30
|
+
{entry.text}
|
|
31
|
+
</a>
|
|
32
|
+
</p>
|
|
33
|
+
))
|
|
34
|
+
}
|
|
35
|
+
<slot />
|
|
36
|
+
</address>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
---
|
|
2
|
+
interface Props {
|
|
3
|
+
highlight: string;
|
|
4
|
+
text: string;
|
|
5
|
+
href?: string;
|
|
6
|
+
variant?: 'secondary' | 'success' | 'warning' | 'danger' | 'info';
|
|
7
|
+
class?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const {
|
|
11
|
+
highlight,
|
|
12
|
+
text,
|
|
13
|
+
href,
|
|
14
|
+
variant = 'secondary',
|
|
15
|
+
class: className,
|
|
16
|
+
} = Astro.props;
|
|
17
|
+
const Content = href ? 'a' : 'div';
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
<aside
|
|
21
|
+
class:list={['mw-announcement', `mw-announcement-${variant}`, className]}
|
|
22
|
+
>
|
|
23
|
+
<Content class="mw-announcement-content" href={href}>
|
|
24
|
+
<span class="mw-announcement-highlight">{highlight}</span>
|
|
25
|
+
<span>{text}</span>
|
|
26
|
+
</Content>
|
|
27
|
+
</aside>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
---
|
|
2
|
+
// A photo or initials in a circle, a square or an upright or wide frame. The
|
|
3
|
+
// photo comes as the slot - an <img> or a Picture.
|
|
4
|
+
interface Props {
|
|
5
|
+
// Instead of a photo, e.g. "SM"
|
|
6
|
+
initials?: string;
|
|
7
|
+
size?: 'xs' | 'sm' | 'lg' | 'xl';
|
|
8
|
+
shape?: 'round' | 'square' | 'portrait' | 'landscape';
|
|
9
|
+
// Sits on the ring, over initials it fills the circle.
|
|
10
|
+
color?: 'primary' | 'secondary' | 'success' | 'warning' | 'danger' | 'info';
|
|
11
|
+
class?: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const {
|
|
15
|
+
initials,
|
|
16
|
+
size,
|
|
17
|
+
shape = 'round',
|
|
18
|
+
color,
|
|
19
|
+
class: className,
|
|
20
|
+
} = Astro.props;
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
<div
|
|
24
|
+
class:list={[
|
|
25
|
+
'mw-avatar',
|
|
26
|
+
initials && 'mw-avatar-initials',
|
|
27
|
+
size && `mw-avatar-${size}`,
|
|
28
|
+
shape !== 'round' && `mw-avatar-${shape}`,
|
|
29
|
+
color && `mw-avatar-${color}`,
|
|
30
|
+
className,
|
|
31
|
+
]}
|
|
32
|
+
>
|
|
33
|
+
{initials ?? <slot />}
|
|
34
|
+
</div>
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
---
|
|
2
|
+
import config from 'virtual:maverick-wave-astro/config';
|
|
3
|
+
|
|
4
|
+
import { withBase } from '../dist/path.js';
|
|
5
|
+
import Favicons from './Favicons.astro';
|
|
6
|
+
|
|
7
|
+
type Props = {
|
|
8
|
+
title: string;
|
|
9
|
+
description: string;
|
|
10
|
+
ogDescription?: string;
|
|
11
|
+
ogType?: 'website' | 'article';
|
|
12
|
+
ogImage?: string | null;
|
|
13
|
+
ogImageAlt?: string;
|
|
14
|
+
noIndex?: boolean;
|
|
15
|
+
lang?: string;
|
|
16
|
+
locale?: string;
|
|
17
|
+
alternates?: { hreflang: string; href: string | URL }[];
|
|
18
|
+
skipLabel?: string;
|
|
19
|
+
// Ends up as data-* on <html>, e.g. { 'promo-until': ... } for the
|
|
20
|
+
// schedule. null and undefined leave the attribute out.
|
|
21
|
+
htmlData?: Record<string, string | null | undefined>;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const { site, ogImage: OG_IMAGE, htmlClasses, designCss } = config;
|
|
25
|
+
|
|
26
|
+
const {
|
|
27
|
+
title,
|
|
28
|
+
description,
|
|
29
|
+
ogDescription = description,
|
|
30
|
+
ogType = 'website',
|
|
31
|
+
ogImage = null,
|
|
32
|
+
ogImageAlt,
|
|
33
|
+
noIndex = false,
|
|
34
|
+
lang = site.lang,
|
|
35
|
+
locale = site.locale,
|
|
36
|
+
alternates = [],
|
|
37
|
+
skipLabel = lang.startsWith('de') ? 'Zum Inhalt springen' : 'Skip to content',
|
|
38
|
+
htmlData = {},
|
|
39
|
+
} = Astro.props;
|
|
40
|
+
|
|
41
|
+
const canonicalUrl = new URL(Astro.url.pathname, Astro.site);
|
|
42
|
+
|
|
43
|
+
// Only the default image has known dimensions, so only it gets width/height.
|
|
44
|
+
const previewImage = new URL(ogImage ?? withBase(OG_IMAGE.path), Astro.site);
|
|
45
|
+
const previewImageAlt =
|
|
46
|
+
ogImageAlt ?? (ogImage ? title : (OG_IMAGE.alt ?? title));
|
|
47
|
+
const hasKnownImageSize = !ogImage;
|
|
48
|
+
|
|
49
|
+
const robots =
|
|
50
|
+
site.noIndex || noIndex
|
|
51
|
+
? 'noindex, nofollow'
|
|
52
|
+
: 'index, follow, max-image-preview:large, max-snippet:-1';
|
|
53
|
+
|
|
54
|
+
const dataAttributes = Object.fromEntries(
|
|
55
|
+
Object.entries(htmlData).map(([name, value]) => [
|
|
56
|
+
`data-${name}`,
|
|
57
|
+
value ?? undefined,
|
|
58
|
+
])
|
|
59
|
+
);
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
<!doctype html>
|
|
63
|
+
<html lang={lang} class:list={htmlClasses} {...dataAttributes}>
|
|
64
|
+
<head>
|
|
65
|
+
<meta charset="UTF-8" />
|
|
66
|
+
<meta
|
|
67
|
+
name="viewport"
|
|
68
|
+
content="width=device-width, minimum-scale=1, initial-scale=1, viewport-fit=cover"
|
|
69
|
+
/>
|
|
70
|
+
{
|
|
71
|
+
site.colorScheme && (
|
|
72
|
+
<meta name="color-scheme" content={site.colorScheme} />
|
|
73
|
+
)
|
|
74
|
+
}
|
|
75
|
+
<title>{title}</title>
|
|
76
|
+
<meta name="description" content={description} />
|
|
77
|
+
<link rel="canonical" href={canonicalUrl} />
|
|
78
|
+
{
|
|
79
|
+
alternates.map(entry => (
|
|
80
|
+
<link rel="alternate" hreflang={entry.hreflang} href={entry.href} />
|
|
81
|
+
))
|
|
82
|
+
}
|
|
83
|
+
<meta name="robots" content={robots} />
|
|
84
|
+
<meta
|
|
85
|
+
name="format-detection"
|
|
86
|
+
content="telephone=no,email=no,address=no,date=no"
|
|
87
|
+
/>
|
|
88
|
+
<meta property="og:title" content={title} />
|
|
89
|
+
<meta property="og:type" content={ogType} />
|
|
90
|
+
<meta property="og:site_name" content={site.name} />
|
|
91
|
+
<meta property="og:description" content={ogDescription} />
|
|
92
|
+
<meta property="og:url" content={canonicalUrl} />
|
|
93
|
+
<meta property="og:locale" content={locale} />
|
|
94
|
+
<meta property="og:image" content={previewImage} />
|
|
95
|
+
<meta property="og:image:alt" content={previewImageAlt} />
|
|
96
|
+
{
|
|
97
|
+
hasKnownImageSize && (
|
|
98
|
+
<Fragment>
|
|
99
|
+
<meta property="og:image:type" content={OG_IMAGE.type} />
|
|
100
|
+
<meta property="og:image:width" content={OG_IMAGE.width} />
|
|
101
|
+
<meta property="og:image:height" content={OG_IMAGE.height} />
|
|
102
|
+
</Fragment>
|
|
103
|
+
)
|
|
104
|
+
}
|
|
105
|
+
<meta name="twitter:card" content="summary_large_image" />
|
|
106
|
+
<meta name="twitter:title" content={title} />
|
|
107
|
+
<meta name="twitter:description" content={ogDescription} />
|
|
108
|
+
<meta name="twitter:image" content={previewImage} />
|
|
109
|
+
<meta name="twitter:image:alt" content={previewImageAlt} />
|
|
110
|
+
<Favicons />
|
|
111
|
+
{
|
|
112
|
+
(site.preloadFonts ?? []).map(font => (
|
|
113
|
+
<link
|
|
114
|
+
rel="preload"
|
|
115
|
+
href={withBase(font)}
|
|
116
|
+
as="font"
|
|
117
|
+
type="font/woff2"
|
|
118
|
+
crossorigin
|
|
119
|
+
/>
|
|
120
|
+
))
|
|
121
|
+
}
|
|
122
|
+
{
|
|
123
|
+
(site.externalStylesheets ?? []).map(href => (
|
|
124
|
+
<link rel="stylesheet" href={href} />
|
|
125
|
+
))
|
|
126
|
+
}
|
|
127
|
+
<slot name="head" />
|
|
128
|
+
{designCss && <link rel="stylesheet" href={withBase('/design.css')} />}
|
|
129
|
+
{site.themeToggle && <script is:inline src={withBase('/theme.js')} />}
|
|
130
|
+
</head>
|
|
131
|
+
|
|
132
|
+
<body class={site.bodyClass || undefined}>
|
|
133
|
+
<a class="mw-skip-link" href="#content">{skipLabel}</a>
|
|
134
|
+
<slot name="header" />
|
|
135
|
+
<slot name="banner" />
|
|
136
|
+
<main id="content" class="mw-main" tabindex="-1">
|
|
137
|
+
<slot />
|
|
138
|
+
</main>
|
|
139
|
+
<slot name="footer" />
|
|
140
|
+
<slot name="scripts" />
|
|
141
|
+
</body>
|
|
142
|
+
</html>
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
---
|
|
2
|
+
// A long article as a page of its own: title, a meta line, tags, an optional
|
|
3
|
+
// picture, the text as Markdown in the slot, and a way on at the end - older,
|
|
4
|
+
// back to the list, newer. A missing neighbour keeps its place empty, so the
|
|
5
|
+
// three parts stay where they are.
|
|
6
|
+
import { config } from '../dist/config.js';
|
|
7
|
+
import { longDate, parseIsoDate } from '../dist/date.js';
|
|
8
|
+
import { PACKAGE_ICONS } from '../dist/icons.js';
|
|
9
|
+
import { publicImage } from '../dist/image-size.js';
|
|
10
|
+
import Icon from './Icon.astro';
|
|
11
|
+
|
|
12
|
+
type Link = { href: string; label: string };
|
|
13
|
+
|
|
14
|
+
interface Props {
|
|
15
|
+
title: string;
|
|
16
|
+
// YYYY-MM-DD
|
|
17
|
+
date?: string;
|
|
18
|
+
author?: string;
|
|
19
|
+
// Already worded, e.g. "3 Min. Lesezeit"
|
|
20
|
+
readingTime?: string;
|
|
21
|
+
tags?: readonly string[];
|
|
22
|
+
// From public/
|
|
23
|
+
image?: { src: string; alt: string };
|
|
24
|
+
older?: Link;
|
|
25
|
+
back?: Link;
|
|
26
|
+
newer?: Link;
|
|
27
|
+
level?: 'h1' | 'h2';
|
|
28
|
+
locale?: string;
|
|
29
|
+
class?: string;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const {
|
|
33
|
+
title,
|
|
34
|
+
date,
|
|
35
|
+
author,
|
|
36
|
+
readingTime,
|
|
37
|
+
tags = [],
|
|
38
|
+
image,
|
|
39
|
+
older,
|
|
40
|
+
back,
|
|
41
|
+
newer,
|
|
42
|
+
level = 'h1',
|
|
43
|
+
locale = config.site.locale.replace('_', '-'),
|
|
44
|
+
class: className,
|
|
45
|
+
} = Astro.props;
|
|
46
|
+
const Title = level;
|
|
47
|
+
const withFooter = older || back || newer;
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
<article class:list={['mw-blog-post', className]}>
|
|
51
|
+
<Title class="mw-blog-post-title mw-text-balance">{title}</Title>
|
|
52
|
+
|
|
53
|
+
<div class="mw-blog-post-header">
|
|
54
|
+
{
|
|
55
|
+
Astro.slots.has('icon') && (
|
|
56
|
+
<div class="mw-blog-post-header-icon">
|
|
57
|
+
<slot name="icon" />
|
|
58
|
+
</div>
|
|
59
|
+
)
|
|
60
|
+
}
|
|
61
|
+
<div class="mw-blog-post-meta">
|
|
62
|
+
{
|
|
63
|
+
date && (
|
|
64
|
+
<div class="mw-blog-post-meta-item">
|
|
65
|
+
<Icon svg={PACKAGE_ICONS.calendar} size={16} />
|
|
66
|
+
<time datetime={date}>{longDate(parseIsoDate(date), locale)}</time>
|
|
67
|
+
</div>
|
|
68
|
+
)
|
|
69
|
+
}
|
|
70
|
+
{
|
|
71
|
+
author && (
|
|
72
|
+
<div class="mw-blog-post-meta-item">
|
|
73
|
+
<Icon svg={PACKAGE_ICONS.person} size={16} />
|
|
74
|
+
<span>{author}</span>
|
|
75
|
+
</div>
|
|
76
|
+
)
|
|
77
|
+
}
|
|
78
|
+
{
|
|
79
|
+
readingTime && (
|
|
80
|
+
<div class="mw-blog-post-meta-item">
|
|
81
|
+
<Icon svg={PACKAGE_ICONS.clock} size={16} />
|
|
82
|
+
<span>{readingTime}</span>
|
|
83
|
+
</div>
|
|
84
|
+
)
|
|
85
|
+
}
|
|
86
|
+
</div>
|
|
87
|
+
</div>
|
|
88
|
+
|
|
89
|
+
{
|
|
90
|
+
tags.length > 0 && (
|
|
91
|
+
<div class="mw-tags mw-tags-secondary mw-mb-7">
|
|
92
|
+
{tags.map(tag => (
|
|
93
|
+
<span class="mw-tags-item">{tag}</span>
|
|
94
|
+
))}
|
|
95
|
+
</div>
|
|
96
|
+
)
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
{
|
|
100
|
+
image && (
|
|
101
|
+
<img
|
|
102
|
+
class="mw-blog-post-featured-image"
|
|
103
|
+
{...publicImage(image.src)}
|
|
104
|
+
alt={image.alt}
|
|
105
|
+
decoding="async"
|
|
106
|
+
/>
|
|
107
|
+
)
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
<div class="mw-blog-post-content-markdown mw-text-pretty">
|
|
111
|
+
<slot />
|
|
112
|
+
</div>
|
|
113
|
+
|
|
114
|
+
{
|
|
115
|
+
withFooter && (
|
|
116
|
+
<div class="mw-blog-post-footer">
|
|
117
|
+
{older ? (
|
|
118
|
+
<a class="mw-btn mw-blog-post-footer-button" href={older.href}>
|
|
119
|
+
<Icon svg={PACKAGE_ICONS['arrow-left']} size={16} />
|
|
120
|
+
<span>{older.label}</span>
|
|
121
|
+
</a>
|
|
122
|
+
) : (
|
|
123
|
+
<span />
|
|
124
|
+
)}
|
|
125
|
+
{back ? (
|
|
126
|
+
<a class="mw-btn mw-btn-outline" href={back.href}>
|
|
127
|
+
{back.label}
|
|
128
|
+
</a>
|
|
129
|
+
) : (
|
|
130
|
+
<span />
|
|
131
|
+
)}
|
|
132
|
+
{newer ? (
|
|
133
|
+
<a class="mw-btn mw-blog-post-footer-button next" href={newer.href}>
|
|
134
|
+
{/* "next" reverses the row and the hover direction. */}
|
|
135
|
+
<Icon svg={PACKAGE_ICONS['arrow-right']} size={16} />
|
|
136
|
+
<span>{newer.label}</span>
|
|
137
|
+
</a>
|
|
138
|
+
) : (
|
|
139
|
+
<span />
|
|
140
|
+
)}
|
|
141
|
+
</div>
|
|
142
|
+
)
|
|
143
|
+
}
|
|
144
|
+
</article>
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
---
|
|
2
|
+
// Path from the start page to the current one. The start page is the house
|
|
3
|
+
// icon, the last item the page itself. collapse hides the middle below lg.
|
|
4
|
+
import { config } from '../dist/config.js';
|
|
5
|
+
import { PACKAGE_ICONS } from '../dist/icons.js';
|
|
6
|
+
import { withBase } from '../dist/path.js';
|
|
7
|
+
import Icon from './Icon.astro';
|
|
8
|
+
|
|
9
|
+
interface Props {
|
|
10
|
+
items: readonly { label: string; href: string }[];
|
|
11
|
+
label?: string;
|
|
12
|
+
homeLabel?: string;
|
|
13
|
+
homeHref?: string;
|
|
14
|
+
collapse?: boolean;
|
|
15
|
+
small?: boolean;
|
|
16
|
+
class?: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const german = config.site.lang.startsWith('de');
|
|
20
|
+
|
|
21
|
+
const {
|
|
22
|
+
items,
|
|
23
|
+
label = german ? 'Sie sind hier' : 'You are here',
|
|
24
|
+
homeLabel = german ? 'Startseite' : 'Start page',
|
|
25
|
+
homeHref = withBase('/'),
|
|
26
|
+
collapse = false,
|
|
27
|
+
small = false,
|
|
28
|
+
class: className = 'mw-mt-8 mw-mb-8',
|
|
29
|
+
} = Astro.props;
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
<nav
|
|
33
|
+
class:list={[
|
|
34
|
+
'mw-breadcrumbs',
|
|
35
|
+
collapse && 'mw-breadcrumbs-collapse',
|
|
36
|
+
small && 'mw-breadcrumbs-sm',
|
|
37
|
+
className,
|
|
38
|
+
]}
|
|
39
|
+
aria-label={label}
|
|
40
|
+
>
|
|
41
|
+
<ol class="mw-breadcrumbs-list">
|
|
42
|
+
<li class="mw-breadcrumbs-item">
|
|
43
|
+
<a href={homeHref} aria-label={homeLabel}>
|
|
44
|
+
<Icon svg={PACKAGE_ICONS.house} size={16} />
|
|
45
|
+
</a>
|
|
46
|
+
</li>
|
|
47
|
+
{
|
|
48
|
+
items.map((item, index) => {
|
|
49
|
+
const current = index === items.length - 1;
|
|
50
|
+
return (
|
|
51
|
+
<li
|
|
52
|
+
class:list={[
|
|
53
|
+
'mw-breadcrumbs-item',
|
|
54
|
+
current && 'mw-breadcrumbs-current',
|
|
55
|
+
]}
|
|
56
|
+
>
|
|
57
|
+
<a
|
|
58
|
+
href={item.href}
|
|
59
|
+
class:list={[current && 'mw-breadcrumbs-active']}
|
|
60
|
+
aria-current={current ? 'page' : undefined}
|
|
61
|
+
>
|
|
62
|
+
<span>{item.label}</span>
|
|
63
|
+
</a>
|
|
64
|
+
</li>
|
|
65
|
+
);
|
|
66
|
+
})
|
|
67
|
+
}
|
|
68
|
+
</ol>
|
|
69
|
+
</nav>
|