sproutsite 0.5.8 → 0.5.12
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 +33 -9
- package/VERSION +1 -1
- package/package.json +7 -7
- package/src/lib/sproutsite/blog-sources.ts +18 -0
- package/src/package/blog-state.ts +26 -0
- package/src/package/blog.ts +10 -0
- package/src/package/content.ts +23 -11
- package/src/package/optional-blog-loader.ts +77 -0
- package/src/package/page.astro +3 -2
- package/src/themes/default/components/molecules/LanguageSwitcher/LanguageSwitcher.astro +2 -1
package/README.md
CHANGED
|
@@ -14,17 +14,33 @@ Official website: [sproutsite.dev](https://sproutsite.dev) · [Documentation](ht
|
|
|
14
14
|
|
|
15
15
|
## Installation
|
|
16
16
|
|
|
17
|
-
Use Sproutsite in your own Astro project. You maintain the content files; the package provides the content model, page assembly, and default theme.
|
|
17
|
+
Use Sproutsite in your own Astro project. You maintain the content files; the package provides the content model, page assembly, and default theme. The published `create-sproutsite` generator prepares a minimal English or German website. Sproutsite has no administration interface.
|
|
18
18
|
|
|
19
|
-
Requires Node.js 24 or
|
|
19
|
+
Requires Node.js 24 or a newer supported LTS version, and npm. Create an English website:
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
```sh
|
|
22
|
+
npm create sproutsite@latest my-website -- --language en
|
|
23
|
+
cd my-website
|
|
24
|
+
npm run dev
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
For German content, use `--language de`. The assistant asks for a website name and whether to install dependencies. If you skip installation, run `npm install` before `npm run dev`. The starter includes Astro configuration, content collections, a shared page route, a small homepage and editorial guidance in `AGENTS.md`. Edit the generated files under `src/content/`; the design stays in the installed Sproutsite package.
|
|
28
|
+
|
|
29
|
+
The German starter serves German directly at `/`. It follows the existing locale convention with `site.de.yaml`, `page.de.yaml` and `.de.md`/`.de.mdx` content, plus base configuration and page metadata. Its README explains which configuration and metadata pairs to keep synchronized. It does not generate an English website.
|
|
30
|
+
|
|
31
|
+
Set your production URL before deployment. The new website's README explains preview, content editing and building. The generator has its own [repository](https://github.com/sproutsite/create-sproutsite) and [npm package](https://www.npmjs.com/package/create-sproutsite); its version is independent of the library.
|
|
32
|
+
|
|
33
|
+
### Manual installation in an Astro project
|
|
34
|
+
|
|
35
|
+
For an existing Astro project, or to configure a new project by hand, use the following setup. The current package supports Astro 7 and MDX 8; these commands use the tested peer-dependency ranges. If you used the generator, skip this manual setup and continue with [Write, Preview, and Publish](#write-preview-and-publish).
|
|
36
|
+
|
|
37
|
+
The library is available on [npm](https://www.npmjs.com/package/sproutsite). For local library changes, use the archive workflow under [Testing a Local Package](#testing-a-local-package).
|
|
22
38
|
|
|
23
39
|
```sh
|
|
24
40
|
mkdir my-website
|
|
25
41
|
cd my-website
|
|
26
42
|
npm init -y
|
|
27
|
-
npm install sproutsite astro@^7.4.
|
|
43
|
+
npm install sproutsite astro@^7.4.12 @astrojs/mdx@^8.1.6
|
|
28
44
|
npm install --save-dev @astrojs/check typescript
|
|
29
45
|
```
|
|
30
46
|
|
|
@@ -505,7 +521,7 @@ These local error documents preserve the original error status. For a subpath de
|
|
|
505
521
|
|
|
506
522
|
## Validation and Limitations
|
|
507
523
|
|
|
508
|
-
A
|
|
524
|
+
A website without blog articles does not need `src/content/blog/`. Missing, empty and asset-only blog directories are handled without missing-directory or empty-collection warnings. The existing empty blog overview remains available; no page URLs are removed. Once source files exist, Astro's glob loader performs the normal loading, schema validation and content watching. A small optional-blog loader waits for the first source file using Astro's public loader watcher API; it does not create placeholders or filter diagnostics for actual content. Page rendering and language navigation query optional collections only after Astro has stored their first entry. A small internal readiness collection records this state through the public loader store API, including watcher updates; files appearing on disk alone do not imply that parsing has finished. This avoids empty-collection warnings during first-article loading and also supports a custom blog directory. The package test checks both warning-free builds and adding, editing and removing the first article without restarting the dev server, with deliberately delayed parsing to exercise requests while loading is still in progress.
|
|
509
525
|
|
|
510
526
|
The demo keeps English showcase and documentation sources in the standard files and German translations in their `.de.md`, `.de.mdx`, and `page.de.yaml` counterparts. English routes use `/showcase/` and `/documentation/`; German routes use `/de/showcase/` and `/de/dokumentation/`, including localized URL segments. Keep both versions up to date when editing examples, labels, image descriptions, or metadata. Markdown links use the source file's locale, and Button applies the active locale and deployment base exactly once. Theme messages are bundled from the local YAML files using Vite raw imports; they are not read from paths relative to generated build chunks.
|
|
511
527
|
|
|
@@ -515,11 +531,11 @@ The validator checks directory association, YAML fields, file names, tones, dupl
|
|
|
515
531
|
|
|
516
532
|
Accessibility testing automates axe, visible keyboard focus, and mobile overflow checks. It does not replace a complete WCAG 2.2 AA conformance assessment or editorial review of headings and link text.
|
|
517
533
|
|
|
518
|
-
|
|
534
|
+
Both the library and the separate `create-sproutsite` initializer are published to npm. The generator is maintained in its own repository with its own version and publication workflow. It creates the documented Astro setup and starter content rather than copying the framework or theme. It supports English or German, optional dependency installation, and localized editorial guidance. Optional extensions remain outside the current scope.
|
|
519
535
|
|
|
520
536
|
## Testing a Local Package
|
|
521
537
|
|
|
522
|
-
|
|
538
|
+
When testing changes to the library, create an archive in the Sproutsite repository:
|
|
523
539
|
|
|
524
540
|
```sh
|
|
525
541
|
npm pack
|
|
@@ -528,7 +544,7 @@ npm pack
|
|
|
528
544
|
Use the filename printed by npm. In your separate consumer project, replace the registry installation command with:
|
|
529
545
|
|
|
530
546
|
```sh
|
|
531
|
-
npm install /absolute/path/to/sproutsite-VERSION.tgz astro@^7.4.
|
|
547
|
+
npm install /absolute/path/to/sproutsite-VERSION.tgz astro@^7.4.12 @astrojs/mdx@^8.1.6
|
|
532
548
|
npm install --save-dev @astrojs/check typescript
|
|
533
549
|
```
|
|
534
550
|
|
|
@@ -585,12 +601,20 @@ Brand colors are separate `--color-brand-*` tokens in `styles/foundation/tokens.
|
|
|
585
601
|
|
|
586
602
|
## Publication Checks
|
|
587
603
|
|
|
588
|
-
Run `npm run test:package` to test the actual npm archive in a fresh consumer project. It checks package metadata/version consistency, required exports and license files, and exclusion of demo/development files. It then installs the local tarball (not a registry package named Sproutsite), runs Astro/TypeScript checking, and builds the consumer for `/` and `/demo/`. The fixture exercises English/German routes, a Markdown section, an MDX accordion with a Lucide icon, theme CSS and fonts, version display, error documents, manifest, and multilingual sitemap. It also verifies that the installed library is a real copy rather than a symlink to this checkout.
|
|
604
|
+
Run `npm run test:package` to test the actual npm archive in a fresh consumer project. It checks package metadata/version consistency, required exports and license files, and exclusion of demo/development files. It then installs the local tarball (not a registry package named Sproutsite), runs Astro/TypeScript checking, and builds the consumer for `/` and `/demo/`. The fixture exercises English/German routes, a Markdown section, an MDX accordion with a Lucide icon, theme CSS and fonts, version display, error documents, manifest, and multilingual sitemap. It also verifies that the installed library is a real copy rather than a symlink to this checkout. Missing and asset-only blogs must build without optional-blog warnings. A temporary Astro dev server then checks adding, editing and removing the first article without a restart, and is stopped after the test.
|
|
589
605
|
|
|
590
606
|
The test uses `scripts/fixtures/package-consumer/`, pins its direct Astro/MDX/checking dependencies to versions in the repository lockfile, and lets npm resolve the library's published dependency ranges. npm may need network access and uses its normal cache. Temporary files are removed after success and retained with their path printed after failure. Lifecycle scripts are suppressed during packing and installation to prevent recursive publication checks and ensure the archive already contains everything it needs. During `npm publish --dry-run`, the nested checks still create and install a real local archive; only their child processes override the inherited dry-run setting, so the outer publication remains a dry run.
|
|
591
607
|
|
|
592
608
|
`npm run prepublishOnly` runs formatting, TypeScript-source enforcement, content/Astro checking, unit tests, the demo build/output checks, and the consumer installation test. npm runs this gate automatically before publishing from this repository; any failing command stops the sequence. Neither running the gate manually nor running the package test publishes anything. A normal `npm pack` remains separate from this gate. Run the existing Storybook and accessibility checks as well when changing components or interactions. Do not bypass the gate with `--ignore-scripts` when publishing; publishing an existing tarball also requires checking that exact artifact beforehand.
|
|
593
609
|
|
|
610
|
+
## Dependency Security
|
|
611
|
+
|
|
612
|
+
Reviewed on 2026-11-18. The tested Astro version is 7.4.12, which is also the minimum accepted by this package's peer range. It includes the fixes for [dynamic-tag attribute injection](https://github.com/advisories/GHSA-mh32-jxcr-mh9f) and the [Node image endpoint path issue](https://github.com/advisories/GHSA-r3h5-4585-7x3w). The default Sproutsite website uses static output without the Node adapter, but the supported Astro range excludes those affected versions regardless.
|
|
613
|
+
|
|
614
|
+
The transitive [picomatch ReDoS advisory GHSA-fc5q-39xc-vjpf](https://github.com/advisories/GHSA-fc5q-39xc-vjpf) remains open: the latest published picomatch version is 4.0.7 and the advisory lists no patched release. npm reports it through several Astro, globbing and developer-tool dependency paths; these are not separate root vulnerabilities. No audit exception or replacement package has been added to hide these reports.
|
|
615
|
+
|
|
616
|
+
This finding concerns Node-based tooling. Deploying `dist/` does not deploy a Node runtime or its npm dependencies. The static output does not eliminate the need to review build inputs and development tooling, and this project does not claim the dependency tree is free of vulnerabilities. Recheck `npm audit` after upstream patches are published. Do not use `npm audit fix --force` without reviewing the proposed changes; its current suggestions include incompatible Astro/MDX downgrades.
|
|
617
|
+
|
|
594
618
|
## License
|
|
595
619
|
|
|
596
620
|
Sproutsite is licensed under the Apache License, Version 2.0.
|
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.5.
|
|
1
|
+
0.5.12
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sproutsite",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.12",
|
|
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.",
|
|
@@ -59,11 +59,11 @@
|
|
|
59
59
|
"build:storybook": "storybook build"
|
|
60
60
|
},
|
|
61
61
|
"peerDependencies": {
|
|
62
|
-
"@astrojs/mdx": "^8.1.
|
|
63
|
-
"astro": "^7.4.
|
|
62
|
+
"@astrojs/mdx": "^8.1.6",
|
|
63
|
+
"astro": "^7.4.12"
|
|
64
64
|
},
|
|
65
65
|
"dependencies": {
|
|
66
|
-
"@astrojs/markdown-remark": "^7.3.
|
|
66
|
+
"@astrojs/markdown-remark": "^7.3.9",
|
|
67
67
|
"@astrojs/sitemap": "^3.7.4",
|
|
68
68
|
"@lucide/astro": "^1.73.0",
|
|
69
69
|
"@shikijs/langs": "^4.5.0",
|
|
@@ -82,15 +82,15 @@
|
|
|
82
82
|
"zod": "^4.3.6"
|
|
83
83
|
},
|
|
84
84
|
"devDependencies": {
|
|
85
|
-
"@astrojs/check": "^0.9.
|
|
86
|
-
"@astrojs/mdx": "^8.1.
|
|
85
|
+
"@astrojs/check": "^0.9.12",
|
|
86
|
+
"@astrojs/mdx": "^8.1.6",
|
|
87
87
|
"@axe-core/playwright": "^4.13.0",
|
|
88
88
|
"@playwright/test": "^1.63.0",
|
|
89
89
|
"@storybook-astro/framework": "^1.15.0",
|
|
90
90
|
"@storybook/addon-docs": "^10.6.6",
|
|
91
91
|
"@storybook/builder-vite": "^10.6.6",
|
|
92
92
|
"@types/fontkit": "^2.0.9",
|
|
93
|
-
"astro": "^7.4.
|
|
93
|
+
"astro": "^7.4.12",
|
|
94
94
|
"axe-core": "^4.13.0",
|
|
95
95
|
"fontkit": "^2.0.4",
|
|
96
96
|
"playwright": "^1.63.0",
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { existsSync, globSync } from 'node:fs';
|
|
2
|
+
import { resolve } from 'node:path';
|
|
3
|
+
|
|
4
|
+
export const blogPatterns = {
|
|
5
|
+
blogPages: '*/page*.yaml',
|
|
6
|
+
blogDocuments: '*/*.{md,mdx}',
|
|
7
|
+
} as const;
|
|
8
|
+
|
|
9
|
+
/** Check optional sources only; Astro still loads and validates their content. */
|
|
10
|
+
export function hasBlogSources(
|
|
11
|
+
collection: keyof typeof blogPatterns,
|
|
12
|
+
directory = resolve(process.cwd(), 'src/content/blog'),
|
|
13
|
+
): boolean {
|
|
14
|
+
return (
|
|
15
|
+
existsSync(directory) &&
|
|
16
|
+
globSync(blogPatterns[collection], { cwd: directory }).length > 0
|
|
17
|
+
);
|
|
18
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Loader } from 'astro/loaders';
|
|
2
|
+
import type { blogPatterns } from '../lib/sproutsite/blog-sources.js';
|
|
3
|
+
|
|
4
|
+
/** Persist readiness alongside Astro's content, rather than infer it from files. */
|
|
5
|
+
export function createBlogReadinessLoader() {
|
|
6
|
+
const readiness = { blogPages: false, blogDocuments: false };
|
|
7
|
+
let context: Parameters<Loader['load']>[0] | undefined;
|
|
8
|
+
const write = () => {
|
|
9
|
+
context?.store.set({ id: 'readiness', data: { ...readiness } });
|
|
10
|
+
};
|
|
11
|
+
const loader: Loader = {
|
|
12
|
+
name: 'sproutsite/blog-readiness',
|
|
13
|
+
async load(nextContext) {
|
|
14
|
+
context = nextContext;
|
|
15
|
+
write();
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
return {
|
|
19
|
+
loader,
|
|
20
|
+
setReady(collection: keyof typeof blogPatterns, ready: boolean) {
|
|
21
|
+
if (readiness[collection] === ready) return;
|
|
22
|
+
readiness[collection] = ready;
|
|
23
|
+
write();
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { getCollection, getEntry } from 'astro:content';
|
|
2
|
+
import type { blogPatterns } from '../lib/sproutsite/blog-sources.js';
|
|
3
|
+
|
|
4
|
+
/** Query optional collections only after Astro has written their first entry. */
|
|
5
|
+
export async function getBlogCollection<C extends keyof typeof blogPatterns>(
|
|
6
|
+
collection: C,
|
|
7
|
+
) {
|
|
8
|
+
const state = await getEntry('sproutsiteBlogState', 'readiness');
|
|
9
|
+
return state?.data[collection] ? getCollection(collection) : [];
|
|
10
|
+
}
|
package/src/package/content.ts
CHANGED
|
@@ -2,6 +2,8 @@ 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 { optionalBlogLoader } from './optional-blog-loader.js';
|
|
6
|
+
import { createBlogReadinessLoader } from './blog-state.js';
|
|
5
7
|
|
|
6
8
|
function blogDirectoryId(entry: string): string {
|
|
7
9
|
const match = entry.match(
|
|
@@ -19,6 +21,14 @@ export function createSproutsiteCollections(
|
|
|
19
21
|
contentDirectory = './src/content/pages',
|
|
20
22
|
blogDirectory = './src/content/blog',
|
|
21
23
|
) {
|
|
24
|
+
const readiness = createBlogReadinessLoader();
|
|
25
|
+
const sproutsiteBlogState = defineCollection({
|
|
26
|
+
loader: readiness.loader,
|
|
27
|
+
schema: z.object({
|
|
28
|
+
blogPages: z.boolean(),
|
|
29
|
+
blogDocuments: z.boolean(),
|
|
30
|
+
}),
|
|
31
|
+
});
|
|
22
32
|
const tone = z
|
|
23
33
|
.union(
|
|
24
34
|
[
|
|
@@ -89,11 +99,12 @@ export function createSproutsiteCollections(
|
|
|
89
99
|
});
|
|
90
100
|
|
|
91
101
|
const blogPages = defineCollection({
|
|
92
|
-
loader:
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
102
|
+
loader: optionalBlogLoader(
|
|
103
|
+
'blogPages',
|
|
104
|
+
blogDirectory,
|
|
105
|
+
({ entry }) => blogDirectoryId(entry),
|
|
106
|
+
(ready) => readiness.setReady('blogPages', ready),
|
|
107
|
+
),
|
|
97
108
|
schema: ({ image }: { image: ImageFunction }) =>
|
|
98
109
|
z.object({
|
|
99
110
|
title: z.string().trim().min(1),
|
|
@@ -105,13 +116,14 @@ export function createSproutsiteCollections(
|
|
|
105
116
|
});
|
|
106
117
|
|
|
107
118
|
const blogDocuments = defineCollection({
|
|
108
|
-
loader:
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
119
|
+
loader: optionalBlogLoader(
|
|
120
|
+
'blogDocuments',
|
|
121
|
+
blogDirectory,
|
|
122
|
+
({ entry }) => entry.replace(/\.(?:md|mdx)$/, ''),
|
|
123
|
+
(ready) => readiness.setReady('blogDocuments', ready),
|
|
124
|
+
),
|
|
113
125
|
schema: documentSchema,
|
|
114
126
|
});
|
|
115
127
|
|
|
116
|
-
return { pages, documents, blogPages, blogDocuments };
|
|
128
|
+
return { pages, documents, blogPages, blogDocuments, sproutsiteBlogState };
|
|
117
129
|
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { glob, type Loader } from 'astro/loaders';
|
|
2
|
+
import { fileURLToPath } from 'node:url';
|
|
3
|
+
import {
|
|
4
|
+
blogPatterns,
|
|
5
|
+
hasBlogSources,
|
|
6
|
+
} from '../lib/sproutsite/blog-sources.js';
|
|
7
|
+
|
|
8
|
+
/** Keep an absent/empty optional blog quiet; delegate actual loading to Astro. */
|
|
9
|
+
export function optionalBlogLoader(
|
|
10
|
+
collection: keyof typeof blogPatterns,
|
|
11
|
+
base: string,
|
|
12
|
+
generateId: (options: { entry: string }) => string,
|
|
13
|
+
onReady: (ready: boolean) => void,
|
|
14
|
+
): Loader {
|
|
15
|
+
const loader = glob({
|
|
16
|
+
base,
|
|
17
|
+
pattern: blogPatterns[collection],
|
|
18
|
+
generateId,
|
|
19
|
+
});
|
|
20
|
+
return {
|
|
21
|
+
name: `sproutsite/optional-${collection}`,
|
|
22
|
+
async load(context) {
|
|
23
|
+
// The filesystem may contain new files before Astro has parsed them.
|
|
24
|
+
// Track actual store writes, including the native loader's watchers.
|
|
25
|
+
const updateReadiness = () =>
|
|
26
|
+
onReady(context.store.keys().length > 0);
|
|
27
|
+
const store: typeof context.store = {
|
|
28
|
+
...context.store,
|
|
29
|
+
set(entry) {
|
|
30
|
+
const result = context.store.set(entry);
|
|
31
|
+
updateReadiness();
|
|
32
|
+
return result;
|
|
33
|
+
},
|
|
34
|
+
delete(id) {
|
|
35
|
+
context.store.delete(id);
|
|
36
|
+
updateReadiness();
|
|
37
|
+
},
|
|
38
|
+
clear() {
|
|
39
|
+
onReady(false);
|
|
40
|
+
context.store.clear();
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
const nativeContext = { ...context, store };
|
|
44
|
+
updateReadiness();
|
|
45
|
+
const directory = fileURLToPath(new URL(base, context.config.root));
|
|
46
|
+
if (hasBlogSources(collection, directory)) {
|
|
47
|
+
await loader.load(nativeContext);
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
store.clear();
|
|
51
|
+
const watcher = context.watcher;
|
|
52
|
+
if (!watcher) return;
|
|
53
|
+
// The native glob loader takes over as soon as the first matching
|
|
54
|
+
// source is created. Do not create folders, placeholder entries or
|
|
55
|
+
// suppress Astro's diagnostics for content that actually exists.
|
|
56
|
+
watcher.add(directory);
|
|
57
|
+
let loading = false;
|
|
58
|
+
const onAdd = async () => {
|
|
59
|
+
if (loading || !hasBlogSources(collection, directory)) return;
|
|
60
|
+
loading = true;
|
|
61
|
+
try {
|
|
62
|
+
await loader.load(nativeContext);
|
|
63
|
+
watcher.off('add', onAdd);
|
|
64
|
+
watcher.off('change', onAdd);
|
|
65
|
+
} catch (error) {
|
|
66
|
+
context.logger.error(
|
|
67
|
+
error instanceof Error ? error.message : String(error),
|
|
68
|
+
);
|
|
69
|
+
} finally {
|
|
70
|
+
loading = false;
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
watcher.on('add', onAdd);
|
|
74
|
+
watcher.on('change', onAdd);
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
}
|
package/src/package/page.astro
CHANGED
|
@@ -10,6 +10,7 @@ import BlogPost from '../themes/default/components/organisms/BlogPost/BlogPost.a
|
|
|
10
10
|
import Hero from '../themes/default/components/organisms/Hero/Hero.astro';
|
|
11
11
|
import PageTitle from '../themes/default/components/organisms/PageTitle/PageTitle.astro';
|
|
12
12
|
import Section from '../themes/default/components/organisms/Section/Section.astro';
|
|
13
|
+
import { getBlogCollection } from './blog.js';
|
|
13
14
|
|
|
14
15
|
type Locale = 'en' | 'de';
|
|
15
16
|
|
|
@@ -33,7 +34,7 @@ export async function getSproutsiteStaticPaths(locale: Locale = 'en') {
|
|
|
33
34
|
},
|
|
34
35
|
props: { page, locale },
|
|
35
36
|
}));
|
|
36
|
-
const posts = (await
|
|
37
|
+
const posts = (await getBlogCollection('blogPages'))
|
|
37
38
|
.filter((entry) => localeOf(entry.id) === locale)
|
|
38
39
|
.sort(
|
|
39
40
|
(left, right) =>
|
|
@@ -41,7 +42,7 @@ export async function getSproutsiteStaticPaths(locale: Locale = 'en') {
|
|
|
41
42
|
);
|
|
42
43
|
const assembledPosts = assemblePages(
|
|
43
44
|
posts,
|
|
44
|
-
(await
|
|
45
|
+
(await getBlogCollection('blogDocuments')).filter(
|
|
45
46
|
(entry) => localeOf(entry.id) === locale,
|
|
46
47
|
),
|
|
47
48
|
(entry) => blogRouteFromId(logicalId(entry.id)),
|
|
@@ -8,6 +8,7 @@ import { t } from '../../../i18n/index.js';
|
|
|
8
8
|
import Icon from '../../atoms/Icon/Icon.astro';
|
|
9
9
|
import englishFlag from 'flag-icons/flags/4x3/gb.svg?url&no-inline';
|
|
10
10
|
import germanFlag from 'flag-icons/flags/4x3/de.svg?url&no-inline';
|
|
11
|
+
import { getBlogCollection } from '../../../../../package/blog.js';
|
|
11
12
|
|
|
12
13
|
interface Props {
|
|
13
14
|
site: SiteConfig;
|
|
@@ -16,7 +17,7 @@ interface Props {
|
|
|
16
17
|
const { site, route } = Astro.props;
|
|
17
18
|
const [pages, posts] = await Promise.all([
|
|
18
19
|
getCollection('pages'),
|
|
19
|
-
|
|
20
|
+
getBlogCollection('blogPages'),
|
|
20
21
|
]);
|
|
21
22
|
const flags: Record<string, string> = { en: englishFlag, de: germanFlag };
|
|
22
23
|
const options = languageLinks(
|