@easy-web/core 1.9.0 → 1.10.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 +27 -3
- package/dist/contracts/capabilities.d.ts +3 -0
- package/dist/contracts/capabilities.d.ts.map +1 -1
- package/dist/contracts/index.d.ts +1 -0
- package/dist/contracts/index.d.ts.map +1 -1
- package/dist/contracts/index.js +1 -0
- package/dist/contracts/index.js.map +1 -1
- package/dist/contracts/ordering.d.ts +6 -0
- package/dist/contracts/ordering.d.ts.map +1 -0
- package/dist/contracts/ordering.js +22 -0
- package/dist/contracts/ordering.js.map +1 -0
- package/dist/contracts/traits.d.ts +4 -0
- package/dist/contracts/traits.d.ts.map +1 -1
- package/dist/contracts/traits.js +3 -1
- package/dist/contracts/traits.js.map +1 -1
- package/dist/recipes/content-site.d.ts.map +1 -1
- package/dist/recipes/content-site.js +213 -42
- package/dist/recipes/content-site.js.map +1 -1
- package/dist/recipes/shell-recipe.d.ts +3 -0
- package/dist/recipes/shell-recipe.d.ts.map +1 -1
- package/dist/recipes/shell-recipe.js +116 -6
- package/dist/recipes/shell-recipe.js.map +1 -1
- package/dist/seo/index.d.ts +5 -0
- package/dist/seo/index.d.ts.map +1 -1
- package/dist/seo/index.js +7 -3
- package/dist/seo/index.js.map +1 -1
- package/dist/seo/rendered-sitemap-alternates.d.ts +7 -0
- package/dist/seo/rendered-sitemap-alternates.d.ts.map +1 -0
- package/dist/seo/rendered-sitemap-alternates.js +232 -0
- package/dist/seo/rendered-sitemap-alternates.js.map +1 -0
- package/package.json +1 -1
- package/src/contracts/__tests__/content-composition.test.ts +17 -0
- package/src/contracts/__tests__/ordering.test.ts +34 -0
- package/src/contracts/capabilities.ts +4 -0
- package/src/contracts/index.ts +1 -0
- package/src/contracts/ordering.ts +33 -0
- package/src/contracts/traits.ts +4 -1
- package/src/recipes/__tests__/content-site.test.ts +91 -2
- package/src/recipes/__tests__/shell-recipe.test.ts +31 -0
- package/src/recipes/content-site.ts +216 -48
- package/src/recipes/shell-recipe.ts +120 -6
- package/src/seo/__tests__/integration.test.ts +28 -0
- package/src/seo/__tests__/rendered-sitemap-alternates.test.ts +127 -0
- package/src/seo/__tests__/sitemap-options.test.ts +7 -7
- package/src/seo/index.ts +17 -3
- package/src/seo/rendered-sitemap-alternates.ts +231 -0
- package/src/type-tests/contracts.ts +6 -0
|
@@ -7,8 +7,15 @@ import type { ShellConfiguration, ShellRecipeOptions } from './shell-recipe.js';
|
|
|
7
7
|
import type { RecipeGeneratedFile, RecipeMetadata } from './types.js';
|
|
8
8
|
import type { RecipeOutputContribution } from './schema.js';
|
|
9
9
|
|
|
10
|
-
const supportedTraits = new Set(['title', 'slug', 'summary', 'image', 'body']);
|
|
10
|
+
const supportedTraits = new Set(['title', 'slug', 'summary', 'image', 'body', 'order']);
|
|
11
11
|
const supportedBindings = new Set(['list', 'detail', 'navigation', 'cms-admin']);
|
|
12
|
+
const contentRuntimeRange = '^1.6.0';
|
|
13
|
+
const orderedContentRuntimeRange = '^1.10.0';
|
|
14
|
+
|
|
15
|
+
function contentRuntimeFor(composition: ContentComposition): string {
|
|
16
|
+
return composition.contentLocales.length > 1 || composition.contentTypes.some((type) => type.traits.includes('order'))
|
|
17
|
+
? orderedContentRuntimeRange : contentRuntimeRange;
|
|
18
|
+
}
|
|
12
19
|
|
|
13
20
|
export interface ContentSiteOptions {
|
|
14
21
|
readonly mediaFolder?: string;
|
|
@@ -16,13 +23,16 @@ export interface ContentSiteOptions {
|
|
|
16
23
|
}
|
|
17
24
|
|
|
18
25
|
export const generatedContentCompositionSchema = contentCompositionSchema.superRefine((composition, context) => {
|
|
19
|
-
|
|
20
|
-
|
|
26
|
+
const locales = composition.contentLocales;
|
|
27
|
+
const localeIds: readonly string[] = locales;
|
|
28
|
+
if (locales.length > 1 && (locales.length !== 2 || !localeIds.includes('de') || !localeIds.includes('en'))) {
|
|
29
|
+
context.addIssue({ code: 'custom', path: ['contentLocales'], message: 'Content generation supports one locale or the bilingual DE/EN pair' });
|
|
21
30
|
}
|
|
22
31
|
if (!composition.contentTypes.length) {
|
|
23
32
|
context.addIssue({ code: 'custom', path: ['contentTypes'], message: 'Content generation requires at least one content type' });
|
|
24
33
|
}
|
|
25
34
|
const routes: string[] = [];
|
|
35
|
+
const localeRoots = new Set(locales.slice(1).map((locale) => `/${locale}`));
|
|
26
36
|
composition.contentTypes.forEach((type, index) => {
|
|
27
37
|
const path = ['contentTypes', index];
|
|
28
38
|
for (const trait of type.traits) {
|
|
@@ -40,7 +50,10 @@ export const generatedContentCompositionSchema = contentCompositionSchema.superR
|
|
|
40
50
|
|| defaultReservedContentRoutes.some((reserved) => reserved !== '/' && `${base}/`.startsWith(reserved))) {
|
|
41
51
|
context.addIssue({ code: 'custom', path: [...path, 'routes'], message: `Unsupported generated content route "${route}"; use non-reserved lowercase path segments` });
|
|
42
52
|
}
|
|
43
|
-
if (
|
|
53
|
+
if (localeRoots.has(base)) {
|
|
54
|
+
context.addIssue({ code: 'custom', path: [...path, 'routes'], message: `Generated content route "${route}" conflicts with the localized home page` });
|
|
55
|
+
}
|
|
56
|
+
if (routes.some((other) => base === other || base.startsWith(`${other}/`) || other.startsWith(`${base}/`))) {
|
|
44
57
|
context.addIssue({ code: 'custom', path: [...path, 'routes'], message: `Generated list/detail routes overlap at "${route}"` });
|
|
45
58
|
}
|
|
46
59
|
routes.push(base);
|
|
@@ -52,12 +65,17 @@ function routeBase(type: ContentTypeDefinition, locale: string): string {
|
|
|
52
65
|
return type.routes[locale]!.replace(/\/$/, '');
|
|
53
66
|
}
|
|
54
67
|
|
|
55
|
-
function collectionSchema(type: ContentTypeDefinition): string {
|
|
68
|
+
function collectionSchema(type: ContentTypeDefinition, locales: readonly string[]): string {
|
|
56
69
|
const shapes = ['...titleTraitSchema.unwrap().shape', '...slugTraitSchema.unwrap().shape'];
|
|
57
70
|
if (type.traits.includes('summary')) shapes.push('...summaryTraitSchema.unwrap().shape');
|
|
58
71
|
if (type.traits.includes('image')) {
|
|
59
72
|
shapes.push('image: imageTraitSchema.unwrap().shape.image.unwrap().extend({ src: image() })');
|
|
60
73
|
}
|
|
74
|
+
if (locales.length > 1) {
|
|
75
|
+
shapes.push(`locale: z.enum(${JSON.stringify(locales)})`);
|
|
76
|
+
shapes.push("translationKey: z.string().min(1).regex(/\\S/, 'Darf nicht nur aus Leerzeichen bestehen.')");
|
|
77
|
+
}
|
|
78
|
+
if (type.traits.includes('order')) shapes.push('...optionalOrderTraitSchema.unwrap().shape');
|
|
61
79
|
// File-based IDs keep duplicate public slugs visible to route validation.
|
|
62
80
|
return `${JSON.stringify(type.id)}: defineCollection({
|
|
63
81
|
loader: glob({ pattern: '**/*.md', base: ${JSON.stringify(`./src/content/${type.id}`)}, generateId: ({ entry }) => entry.replace(/\\.md$/, '') }),
|
|
@@ -65,40 +83,86 @@ function collectionSchema(type: ContentTypeDefinition): string {
|
|
|
65
83
|
})`;
|
|
66
84
|
}
|
|
67
85
|
|
|
68
|
-
function adapterSource(type: ContentTypeDefinition,
|
|
69
|
-
const contracts = [
|
|
86
|
+
function adapterSource(type: ContentTypeDefinition, index: number, locales: readonly string[]): string {
|
|
87
|
+
const contracts = [
|
|
88
|
+
'HasTitle',
|
|
89
|
+
'HasSlug',
|
|
90
|
+
...(type.traits.includes('summary') ? ['HasSummary'] : []),
|
|
91
|
+
...(type.traits.includes('image') ? ['HasImage'] : []),
|
|
92
|
+
...(type.traits.includes('order') ? ['HasOptionalOrder'] : []),
|
|
93
|
+
];
|
|
94
|
+
const localeType = locales.map((locale) => JSON.stringify(locale)).join(' | ');
|
|
95
|
+
const defaultLocale = locales[0]!;
|
|
96
|
+
const localized = locales.length > 1;
|
|
70
97
|
return `import type { CollectionEntry } from 'astro:content';
|
|
71
98
|
import { assertImplements, type Item, type Linkable, ${contracts.map((name) => `type ${name}`).join(', ')} } from '@easy-web/core/contracts';
|
|
72
99
|
import { composition } from '../../content/definitions';
|
|
73
100
|
|
|
74
101
|
type Entry = CollectionEntry<${JSON.stringify(type.id)}>;
|
|
75
102
|
assertImplements<Entry['data'], ${contracts.join(' & ')}>();
|
|
76
|
-
|
|
77
|
-
export function toItem(entry: Entry): Item & Linkable {
|
|
103
|
+
${localized ? `type ContentLocale = ${localeType};\n` : ''}
|
|
104
|
+
export function toItem(entry: Entry${localized ? `, locale: ContentLocale = ${JSON.stringify(defaultLocale)}, basePath = import.meta.env.BASE_URL.replace(/\\/$/, '')` : ''}): Item & Linkable {
|
|
78
105
|
const data = entry.data;
|
|
79
106
|
return {
|
|
80
107
|
title: data.title,
|
|
81
108
|
${type.traits.includes('summary') ? 'description: data.summary,' : ''}
|
|
82
109
|
${type.traits.includes('image') ? 'image: data.image,' : ''}
|
|
83
|
-
href: composition.contentTypes[${index}].routes[${JSON.stringify(
|
|
110
|
+
href: ${localized ? `basePath + ` : `import.meta.env.BASE_URL.replace(/\\/$/, '') + `}composition.contentTypes[${index}].routes[${localized ? 'locale' : JSON.stringify(defaultLocale)}].replace(/\\/$/, '') + '/' + data.slug + '/',
|
|
84
111
|
};
|
|
85
112
|
}
|
|
86
113
|
`;
|
|
87
114
|
}
|
|
88
115
|
|
|
89
|
-
function listSource(type: ContentTypeDefinition, locale: string): string {
|
|
116
|
+
function listSource(type: ContentTypeDefinition, locale: string, composition: ContentComposition): string {
|
|
90
117
|
const prefix = '../'.repeat(routeBase(type, locale).split('/').length);
|
|
118
|
+
const localized = composition.contentLocales.length > 1;
|
|
119
|
+
const localeFilter = localized ? `, ({ data }) => data.locale === ${JSON.stringify(locale)}` : '';
|
|
120
|
+
const localizedPaths = JSON.stringify([Object.fromEntries(composition.contentLocales.map((itemLocale) => [itemLocale, `${routeBase(type, itemLocale)}/`]))]);
|
|
121
|
+
const localizedBaseSetup = localized ? `
|
|
122
|
+
const routePath = ${JSON.stringify(`${routeBase(type, locale)}/`)};
|
|
123
|
+
const pagePath = Astro.url.pathname.replace(/\\/+$/, '') || '/';
|
|
124
|
+
const routeWithoutSlash = routePath.replace(/\\/+$/, '') || '/';
|
|
125
|
+
const sitePrefix = routeWithoutSlash === '/' ? (pagePath === '/' ? '' : pagePath)
|
|
126
|
+
: pagePath.endsWith(routeWithoutSlash) ? pagePath.slice(0, -routeWithoutSlash.length) : '';
|
|
127
|
+
` : '';
|
|
128
|
+
const alternateSetup = localized ? `
|
|
129
|
+
const localizedPathGroups = ${localizedPaths};
|
|
130
|
+
const alternates = getAlternateLinks({
|
|
131
|
+
path: routePath, locales: ${JSON.stringify(composition.contentLocales)},
|
|
132
|
+
defaultLocale: ${JSON.stringify(composition.contentLocales[0])},
|
|
133
|
+
baseUrl: new URL(sitePrefix ? sitePrefix + '/' : '/', Astro.site?.toString() ?? 'https://replace-with-your-domain.example').toString(),
|
|
134
|
+
localizedPaths: localizedPathGroups,
|
|
135
|
+
trailingSlash: ambientTrailingSlash(),
|
|
136
|
+
});
|
|
137
|
+
const alternateHref = alternates.find(({ hreflang }) => hreflang !== ${JSON.stringify(locale)} && hreflang !== 'x-default')?.href;
|
|
138
|
+
` : '';
|
|
139
|
+
const localeArgument = localized ? `, ${JSON.stringify(locale)}, sitePrefix` : '';
|
|
140
|
+
const itemMapping = type.traits.includes('order')
|
|
141
|
+
? `.sort((left, right) => compareContentOrder(
|
|
142
|
+
{ order: left.data.order, slug: left.data.slug, id: left.id },
|
|
143
|
+
{ order: right.data.order, slug: right.data.slug, id: right.id },
|
|
144
|
+
${JSON.stringify(locale)},
|
|
145
|
+
))
|
|
146
|
+
${localized ? `.map((entry) => toItem(entry${localeArgument}))` : '.map(toItem)'}`
|
|
147
|
+
: localized
|
|
148
|
+
? `.sort((left, right) => left.data.slug < right.data.slug ? -1 : left.data.slug > right.data.slug ? 1 : left.id < right.id ? -1 : left.id > right.id ? 1 : 0)
|
|
149
|
+
.map((entry) => toItem(entry${localeArgument}))`
|
|
150
|
+
: `.map(toItem).sort((left, right) => left.href < right.href ? -1 : left.href > right.href ? 1 : 0)`;
|
|
91
151
|
return `---
|
|
92
152
|
import { getCollection } from 'astro:content';
|
|
93
153
|
import Base from '${prefix}layouts/Base.astro';
|
|
94
154
|
import { toItem } from '${prefix}lib/content/${type.id}';
|
|
155
|
+
${type.traits.includes('order') ? "import { compareContentOrder } from '@easy-web/core/contracts';" : ''}
|
|
95
156
|
import Card from '@easy-web/core/components/Card.astro';
|
|
96
157
|
import CardGrid from '@easy-web/core/components/CardGrid.astro';
|
|
158
|
+
${localized ? "import { getAlternateLinks, ambientTrailingSlash } from '@easy-web/core/i18n';" : ''}
|
|
97
159
|
|
|
98
|
-
|
|
99
|
-
|
|
160
|
+
${localizedBaseSetup}
|
|
161
|
+
const items = (await getCollection(${JSON.stringify(type.id)}${localeFilter}))
|
|
162
|
+
${itemMapping};
|
|
163
|
+
${alternateSetup}
|
|
100
164
|
---
|
|
101
|
-
<Base title={${JSON.stringify(type.labels[locale])}}>
|
|
165
|
+
<Base title={${JSON.stringify(type.labels[locale])}}${localized ? ` locale={${JSON.stringify(locale)}} basePath={sitePrefix} alternates={alternates} alternateHref={alternateHref}` : ''}>
|
|
102
166
|
<h1>{${JSON.stringify(type.labels[locale])}}</h1>
|
|
103
167
|
<CardGrid>
|
|
104
168
|
{items.map((item) => <Card item={item} />)}
|
|
@@ -107,32 +171,84 @@ const items = (await getCollection(${JSON.stringify(type.id)}))
|
|
|
107
171
|
`;
|
|
108
172
|
}
|
|
109
173
|
|
|
110
|
-
function detailSource(type: ContentTypeDefinition, locale: string): string {
|
|
174
|
+
function detailSource(type: ContentTypeDefinition, locale: string, composition: ContentComposition): string {
|
|
111
175
|
const prefix = '../'.repeat(routeBase(type, locale).split('/').length);
|
|
176
|
+
const localized = composition.contentLocales.length > 1;
|
|
177
|
+
const currentRoute = JSON.stringify(`${routeBase(type, locale)}/`);
|
|
178
|
+
const alternateListRoute = localized
|
|
179
|
+
? JSON.stringify(`${routeBase(type, composition.contentLocales.find((itemLocale) => itemLocale !== locale)! )}/`)
|
|
180
|
+
: "''";
|
|
181
|
+
const localizedSetup = localized ? `
|
|
182
|
+
const routeBases = ${JSON.stringify(Object.fromEntries(composition.contentLocales.map((itemLocale) => [
|
|
183
|
+
itemLocale, routeBase(type, itemLocale),
|
|
184
|
+
])))};
|
|
185
|
+
` : '';
|
|
186
|
+
const localizedMap = localized ? `
|
|
187
|
+
const translations = allEntries.filter((candidate) => candidate.data.translationKey === entry.data.translationKey);
|
|
188
|
+
const translatedLocales = new Set<string>();
|
|
189
|
+
for (const candidate of translations) {
|
|
190
|
+
if (translatedLocales.has(candidate.data.locale)) {
|
|
191
|
+
throw new Error('Duplicate translationKey in locale: ' + candidate.data.translationKey + ' (' + candidate.data.locale + ')');
|
|
192
|
+
}
|
|
193
|
+
translatedLocales.add(candidate.data.locale);
|
|
194
|
+
}
|
|
195
|
+
const localizedPaths = translations.length > 1
|
|
196
|
+
? Object.fromEntries(translations.map((candidate) => [
|
|
197
|
+
candidate.data.locale, routeBases[candidate.data.locale] + '/' + candidate.data.slug + '/',
|
|
198
|
+
]))
|
|
199
|
+
: undefined;
|
|
200
|
+
return { params: { slug: entry.data.slug }, props: { entry, localizedPaths } };
|
|
201
|
+
` : `
|
|
202
|
+
return { params: { slug: entry.data.slug }, props: { entry } };
|
|
203
|
+
`;
|
|
204
|
+
const localeArgument = localized ? `, ${JSON.stringify(locale)}` : '';
|
|
112
205
|
return `---
|
|
113
206
|
import { getCollection, render, type CollectionEntry } from 'astro:content';
|
|
114
207
|
import type { Rendered, Item, Linkable } from '@easy-web/core/contracts';
|
|
115
208
|
import Base from '${prefix}layouts/Base.astro';
|
|
116
209
|
import { toItem } from '${prefix}lib/content/${type.id}';
|
|
117
210
|
import Prose from '@easy-web/core/components/Prose.astro';
|
|
211
|
+
${localized ? "import { getAlternateLinks, ambientTrailingSlash } from '@easy-web/core/i18n';" : ''}
|
|
118
212
|
${type.traits.includes('image') ? "import Media from '@easy-web/core/components/Media.astro';" : ''}
|
|
213
|
+
interface Props { entry: CollectionEntry<${JSON.stringify(type.id)}>${localized ? '; localizedPaths?: Record<string, string>' : ''} }
|
|
214
|
+
type StaticPath = { params: { slug: string }; props: Props };
|
|
119
215
|
|
|
120
|
-
export async function getStaticPaths() {
|
|
121
|
-
const
|
|
216
|
+
export async function getStaticPaths(): Promise<StaticPath[]> {
|
|
217
|
+
const allEntries = await getCollection(${JSON.stringify(type.id)});
|
|
218
|
+
const entries = ${localized ? `allEntries.filter((entry) => entry.data.locale === ${JSON.stringify(locale)})` : 'allEntries'};
|
|
122
219
|
const seen = new Set<string>();
|
|
220
|
+
${localizedSetup}
|
|
123
221
|
return entries.map((entry) => {
|
|
124
222
|
if (seen.has(entry.data.slug)) throw new Error('Duplicate content slug: ' + entry.data.slug);
|
|
125
223
|
seen.add(entry.data.slug);
|
|
126
|
-
|
|
127
|
-
});
|
|
224
|
+
${localizedMap} });
|
|
128
225
|
}
|
|
129
226
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
const
|
|
227
|
+
const { entry${localized ? ', localizedPaths' : ''} } = Astro.props;
|
|
228
|
+
${localized ? `
|
|
229
|
+
const localizedPathGroups = localizedPaths
|
|
230
|
+
? [localizedPaths]
|
|
231
|
+
: undefined;
|
|
232
|
+
const routePath = ${currentRoute} + entry.data.slug + '/';
|
|
233
|
+
const pagePath = Astro.url.pathname.replace(/\\/+$/, '') || '/';
|
|
234
|
+
const routeWithoutSlash = routePath.replace(/\\/+$/, '') || '/';
|
|
235
|
+
const sitePrefix = routeWithoutSlash === '/' ? (pagePath === '/' ? '' : pagePath)
|
|
236
|
+
: pagePath.endsWith(routeWithoutSlash) ? pagePath.slice(0, -routeWithoutSlash.length) : '';
|
|
237
|
+
const alternates = localizedPathGroups ? getAlternateLinks({
|
|
238
|
+
path: routePath,
|
|
239
|
+
locales: ${JSON.stringify(composition.contentLocales)},
|
|
240
|
+
defaultLocale: ${JSON.stringify(composition.contentLocales[0])},
|
|
241
|
+
baseUrl: new URL(sitePrefix ? sitePrefix + '/' : '/', Astro.site?.toString() ?? 'https://replace-with-your-domain.example').toString(),
|
|
242
|
+
localizedPaths: localizedPathGroups,
|
|
243
|
+
trailingSlash: ambientTrailingSlash(),
|
|
244
|
+
}) : [];
|
|
245
|
+
const alternateHref = alternates.find(({ hreflang }) => hreflang !== ${JSON.stringify(locale)} && hreflang !== 'x-default')?.href
|
|
246
|
+
?? sitePrefix + ${alternateListRoute};
|
|
247
|
+
` : ''}
|
|
248
|
+
const rendered: Rendered<Item & Linkable> = { ...toItem(entry${localeArgument}), ...(await render(entry)) };
|
|
133
249
|
const { Content } = rendered;
|
|
134
250
|
---
|
|
135
|
-
<Base title={rendered.title} description={rendered.description}${type.traits.includes('image') ? ' image={rendered.image?.src && (typeof rendered.image.src === \'string\' ? rendered.image.src : rendered.image.src.src)}' : ''}>
|
|
251
|
+
<Base title={rendered.title} description={rendered.description}${localized ? ` locale={${JSON.stringify(locale)}} basePath={sitePrefix} alternates={alternates} alternateHref={alternateHref}` : ''}${type.traits.includes('image') ? ' image={rendered.image?.src && (typeof rendered.image.src === \'string\' ? rendered.image.src : rendered.image.src.src)}' : ''}>
|
|
136
252
|
<Prose>
|
|
137
253
|
<h1>{rendered.title}</h1>
|
|
138
254
|
{rendered.description && <p>{rendered.description}</p>}
|
|
@@ -144,41 +260,62 @@ const { Content } = rendered;
|
|
|
144
260
|
}
|
|
145
261
|
|
|
146
262
|
function contentFiles(composition: ContentComposition, options: ContentSiteOptions): readonly RecipeGeneratedFile[] {
|
|
147
|
-
const
|
|
263
|
+
const locales = composition.contentLocales;
|
|
264
|
+
const localized = locales.length > 1;
|
|
265
|
+
const runtimeRange = contentRuntimeFor(composition);
|
|
148
266
|
const mediaFolder = z.string().regex(/^src\/assets(?:\/[a-z0-9]+(?:-[a-z0-9]+)*)*$/)
|
|
149
267
|
.parse(options.mediaFolder ?? 'src/assets');
|
|
150
268
|
const exampleImage = `${mediaFolder}/content-example.svg`;
|
|
151
269
|
const files: RecipeGeneratedFile[] = [
|
|
152
270
|
{ path: 'src/content/definitions.ts', content: `import { defineCollection, z } from 'astro:content';
|
|
153
271
|
import { glob } from 'astro/loaders';
|
|
154
|
-
import { titleTraitSchema, slugTraitSchema${composition.contentTypes.some((type) => type.traits.includes('summary')) ? ', summaryTraitSchema' : ''}${composition.contentTypes.some((type) => type.traits.includes('image')) ? ', imageTraitSchema' : ''} } from '@easy-web/core/contracts';
|
|
272
|
+
import { titleTraitSchema, slugTraitSchema${composition.contentTypes.some((type) => type.traits.includes('summary')) ? ', summaryTraitSchema' : ''}${composition.contentTypes.some((type) => type.traits.includes('image')) ? ', imageTraitSchema' : ''}${composition.contentTypes.some((type) => type.traits.includes('order')) ? ', optionalOrderTraitSchema' : ''} } from '@easy-web/core/contracts';
|
|
155
273
|
|
|
156
274
|
export const composition = ${JSON.stringify(composition, null, 2)} as const;
|
|
157
275
|
|
|
158
276
|
export const collections = {
|
|
159
|
-
${composition.contentTypes.map(collectionSchema).join(',\n ')},
|
|
277
|
+
${composition.contentTypes.map((type) => collectionSchema(type, locales)).join(',\n ')},
|
|
160
278
|
};
|
|
161
279
|
` },
|
|
162
280
|
{ path: 'src/content.config.ts', content: "export { collections } from './content/definitions';\n" },
|
|
281
|
+
{ path: 'package.json', content: `${JSON.stringify({ dependencies: {
|
|
282
|
+
'@easy-web/core': runtimeRange,
|
|
283
|
+
...(composition.contentTypes.some((type) => type.traits.includes('image')) ? { sharp: '^0.35.0' } : {}),
|
|
284
|
+
} }, null, 2)}\n` },
|
|
163
285
|
];
|
|
164
286
|
if (composition.contentTypes.some((type) => type.traits.includes('image'))) {
|
|
165
|
-
files.push({ path: 'package.json', content: `${JSON.stringify({ dependencies: { sharp: '^0.35.0' } }, null, 2)}\n` });
|
|
166
287
|
files.push({ path: exampleImage, content: '<svg xmlns="http://www.w3.org/2000/svg" width="640" height="360" viewBox="0 0 640 360"><rect width="640" height="360" fill="#334155"/><circle cx="320" cy="180" r="90" fill="#94a3b8"/></svg>\n' });
|
|
167
288
|
}
|
|
168
289
|
for (const [index, type] of composition.contentTypes.entries()) {
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
290
|
+
files.push({ path: `src/lib/content/${type.id}.ts`, content: adapterSource(type, index, locales) });
|
|
291
|
+
for (const locale of locales) {
|
|
292
|
+
const isGerman = locale === 'de';
|
|
293
|
+
const data = {
|
|
294
|
+
title: `${type.labels[locale]} - ${isGerman ? 'Beispiel' : 'Example'}`,
|
|
295
|
+
slug: 'example',
|
|
296
|
+
...(localized ? { locale, translationKey: 'example' } : {}),
|
|
297
|
+
...(type.traits.includes('summary') ? { summary: isGerman ? 'Generierter Beispielinhalt.' : 'Generated example content.' } : {}),
|
|
298
|
+
...(type.traits.includes('image') ? {
|
|
299
|
+
image: {
|
|
300
|
+
src: posix.relative(`src/content/${type.id}${localized ? `/${locale}` : ''}`, exampleImage),
|
|
301
|
+
alt: isGerman ? 'Kreis auf dunklem Hintergrund' : 'Circle on a dark background',
|
|
302
|
+
},
|
|
303
|
+
} : {}),
|
|
304
|
+
};
|
|
305
|
+
const contentFolder = `src/content/${type.id}${localized ? `/${locale}` : ''}`;
|
|
306
|
+
const body = isGerman ? 'Ersetze diesen Beispielinhalt vor der Veroeffentlichung.' : 'Replace this example content before production.';
|
|
307
|
+
files.push({
|
|
308
|
+
path: `${contentFolder}/example.md`,
|
|
309
|
+
content: `---\n${JSON.stringify(data, null, 2)}\n---\n\n${body}\n`,
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
for (const locale of locales) {
|
|
313
|
+
const route = routeBase(type, locale).slice(1);
|
|
314
|
+
files.push(
|
|
315
|
+
{ path: `src/pages/${route}/index.astro`, content: listSource(type, locale, composition) },
|
|
316
|
+
{ path: `src/pages/${route}/[slug].astro`, content: detailSource(type, locale, composition) },
|
|
317
|
+
);
|
|
318
|
+
}
|
|
182
319
|
}
|
|
183
320
|
return files;
|
|
184
321
|
}
|
|
@@ -189,7 +326,24 @@ export function createContentSiteRecipes(rawComposition: unknown, options: Conte
|
|
|
189
326
|
readonly content: RecipeMetadata;
|
|
190
327
|
} {
|
|
191
328
|
const composition = generatedContentCompositionSchema.parse(rawComposition);
|
|
192
|
-
const
|
|
329
|
+
const locales = composition.contentLocales;
|
|
330
|
+
const locale = locales[0]!;
|
|
331
|
+
const runtimeRange = contentRuntimeFor(composition);
|
|
332
|
+
const navigationByLocale = Object.fromEntries(locales.map((contentLocale) => [
|
|
333
|
+
contentLocale,
|
|
334
|
+
composition.contentTypes.filter((type) => type.bindings.includes('navigation'))
|
|
335
|
+
.map((type) => ({ label: type.labels[contentLocale]!, href: `${routeBase(type, contentLocale)}/` })),
|
|
336
|
+
]));
|
|
337
|
+
const localizedPaths = locales.length > 1
|
|
338
|
+
? [
|
|
339
|
+
Object.fromEntries(locales.map((contentLocale) => [
|
|
340
|
+
contentLocale, contentLocale === locale ? '/' : `/${contentLocale}/`,
|
|
341
|
+
])),
|
|
342
|
+
...composition.contentTypes.map((type) => Object.fromEntries(locales.map((contentLocale) => [
|
|
343
|
+
contentLocale, `${routeBase(type, contentLocale)}/`,
|
|
344
|
+
]))),
|
|
345
|
+
]
|
|
346
|
+
: [];
|
|
193
347
|
const files = contentFiles(composition, options);
|
|
194
348
|
const contributions: RecipeOutputContribution[] = files
|
|
195
349
|
.filter(({ path }) => !path.startsWith('src/pages/'))
|
|
@@ -197,25 +351,39 @@ export function createContentSiteRecipes(rawComposition: unknown, options: Conte
|
|
|
197
351
|
for (const type of composition.contentTypes) {
|
|
198
352
|
contributions.push(
|
|
199
353
|
{ kind: 'content', id: `content.type.${type.id}`, target: type.primary ? 'primary' : 'additional' },
|
|
200
|
-
|
|
201
|
-
|
|
354
|
+
...locales.flatMap((contentLocale) => [
|
|
355
|
+
{ kind: 'route' as const, id: `content.list.${type.id}.${contentLocale}`, target: `${routeBase(type, contentLocale)}/` },
|
|
356
|
+
{ kind: 'route' as const, id: `content.detail.${type.id}.${contentLocale}`, target: `${routeBase(type, contentLocale)}/[slug]` },
|
|
357
|
+
]),
|
|
202
358
|
...type.bindings.map((binding) => ({ kind: 'binding' as const, id: `content.binding.${type.id}.${binding}`, target: `content.type.${type.id}` })),
|
|
203
359
|
);
|
|
204
360
|
}
|
|
205
|
-
const
|
|
206
|
-
|
|
361
|
+
const shellOutputContributions = locales.length > 1
|
|
362
|
+
? [
|
|
363
|
+
...shellRecipe.outputContributions,
|
|
364
|
+
...locales.slice(1).map((contentLocale) => ({
|
|
365
|
+
kind: 'route' as const, id: `shell.home.${contentLocale}`, target: `/${contentLocale}/`,
|
|
366
|
+
})),
|
|
367
|
+
]
|
|
368
|
+
: shellRecipe.outputContributions;
|
|
207
369
|
return {
|
|
208
370
|
shell: {
|
|
209
371
|
...shellRecipe,
|
|
372
|
+
outputContributions: shellOutputContributions,
|
|
210
373
|
validators: [{
|
|
211
374
|
id: 'shell.content-locale', phase: 'options',
|
|
212
|
-
validate: ({ options }) =>
|
|
375
|
+
validate: ({ options: shellOptions }) => shellOptions.defaultLocale === locale ? [] : [{ code: 'CONTENT_LOCALE_MISMATCH', message: 'shell.defaultLocale must match the content composition locale' }],
|
|
213
376
|
}],
|
|
214
|
-
generate: ({ options: shellOptions }) => ({
|
|
377
|
+
generate: ({ options: shellOptions }) => ({
|
|
378
|
+
files: buildShellFiles(shellOptions, navigationByLocale[locale]!, {
|
|
379
|
+
...options.shellConfiguration,
|
|
380
|
+
...(locales.length > 1 ? { contentLocales: locales, navigationByLocale, localizedPaths } : {}),
|
|
381
|
+
}),
|
|
382
|
+
}),
|
|
215
383
|
},
|
|
216
384
|
content: {
|
|
217
385
|
id: 'content.pages', version: '1.7.1', protocolVersion: 1,
|
|
218
|
-
compatibleCliRange: '^0.1.0 || ^0.2.0
|
|
386
|
+
compatibleCliRange: '^0.1.0 || ^0.2.0 || ^0.3.0', compatibleRuntimeRange: runtimeRange,
|
|
219
387
|
provides: ['content.pages', 'content.typed-definitions'], requires: ['site.shell'], conflicts: [],
|
|
220
388
|
order: { priority: 10, key: 'content' }, optionsSchema: z.strictObject({}),
|
|
221
389
|
outputContributions: contributions, validators: [],
|
|
@@ -19,9 +19,25 @@ export interface ShellConfiguration {
|
|
|
19
19
|
readonly imports?: readonly string[];
|
|
20
20
|
readonly integrations?: readonly string[];
|
|
21
21
|
readonly markdownProcessor?: string;
|
|
22
|
+
readonly contentLocales?: readonly string[];
|
|
23
|
+
readonly navigationByLocale?: Readonly<Record<string, readonly NavItem[]>>;
|
|
24
|
+
readonly localizedPaths?: readonly Readonly<Record<string, string>>[];
|
|
22
25
|
}
|
|
23
26
|
|
|
24
27
|
function astroConfig(options: ShellRecipeOptions, configuration: ShellConfiguration): string {
|
|
28
|
+
const locales = configuration.contentLocales;
|
|
29
|
+
const multilingual = !!locales && locales.length > 1;
|
|
30
|
+
const seoOptions = {
|
|
31
|
+
noIndex: options.noIndex,
|
|
32
|
+
...(multilingual ? {
|
|
33
|
+
sitemapLocales: Object.fromEntries(locales!.map((locale) => [locale, locale])),
|
|
34
|
+
localizedPaths: configuration.localizedPaths,
|
|
35
|
+
synchronizeRenderedAlternates: true,
|
|
36
|
+
} : {}),
|
|
37
|
+
};
|
|
38
|
+
const seoConfig = multilingual
|
|
39
|
+
? `easyWebSeo(${JSON.stringify(seoOptions)})`
|
|
40
|
+
: `easyWebSeo({ noIndex: ${options.noIndex ? 'true' : 'false'} })`;
|
|
25
41
|
return `import { defineConfig } from 'astro/config';
|
|
26
42
|
import easyWebSeo from '@easy-web/core/seo';
|
|
27
43
|
${(configuration.imports ?? []).join('\n')}
|
|
@@ -29,8 +45,9 @@ ${(configuration.imports ?? []).join('\n')}
|
|
|
29
45
|
export default defineConfig({
|
|
30
46
|
site: ${JSON.stringify(PLACEHOLDER_SITE_URL)},
|
|
31
47
|
${configuration.markdownProcessor ? `markdown: { processor: ${configuration.markdownProcessor} },` : ''}
|
|
48
|
+
${multilingual ? `i18n: { defaultLocale: ${JSON.stringify(options.defaultLocale)}, locales: ${JSON.stringify(locales)} },` : ''}
|
|
32
49
|
integrations: [
|
|
33
|
-
|
|
50
|
+
${seoConfig},
|
|
34
51
|
${(configuration.integrations ?? []).map((integration) => `${integration},`).join('\n ')}
|
|
35
52
|
],
|
|
36
53
|
});
|
|
@@ -49,7 +66,67 @@ const pnpmWorkspace = `allowBuilds:
|
|
|
49
66
|
sharp: true
|
|
50
67
|
`;
|
|
51
68
|
|
|
52
|
-
function baseLayout(options: ShellRecipeOptions, navigation: readonly NavItem[]): string {
|
|
69
|
+
function baseLayout(options: ShellRecipeOptions, navigation: readonly NavItem[], configuration: ShellConfiguration): string {
|
|
70
|
+
const locales = configuration.contentLocales;
|
|
71
|
+
if (locales && locales.length > 1) {
|
|
72
|
+
return `---
|
|
73
|
+
import PageShell from '@easy-web/core/components/PageShell.astro';
|
|
74
|
+
import Header from '@easy-web/core/components/Header.astro';
|
|
75
|
+
import Footer from '@easy-web/core/components/Footer.astro';
|
|
76
|
+
import SeoHead from '@easy-web/core/components/SeoHead.astro';
|
|
77
|
+
import '@easy-web/core/styles/tokens.css';
|
|
78
|
+
|
|
79
|
+
interface Props {
|
|
80
|
+
title: string;
|
|
81
|
+
description?: string;
|
|
82
|
+
image?: string;
|
|
83
|
+
locale?: string;
|
|
84
|
+
basePath?: string;
|
|
85
|
+
alternates?: { hreflang: string; href: string }[];
|
|
86
|
+
alternateHref?: string;
|
|
87
|
+
}
|
|
88
|
+
const { title, description, image, locale = ${JSON.stringify(options.defaultLocale)}, basePath: configuredBasePath, alternates = [], alternateHref } = Astro.props;
|
|
89
|
+
const siteName = ${JSON.stringify(options.siteName)};
|
|
90
|
+
const currentLang = locale;
|
|
91
|
+
const locales = ${JSON.stringify(locales)};
|
|
92
|
+
const navigationByLocale: Record<string, { label: string; href: string }[]> = ${JSON.stringify(configuration.navigationByLocale ?? { [options.defaultLocale]: navigation })};
|
|
93
|
+
const basePath = configuredBasePath ?? import.meta.env.BASE_URL.replace(/\\/$/, '');
|
|
94
|
+
const navItems = (navigationByLocale[currentLang] ?? []).map((item) => ({ ...item, href: basePath + item.href }));
|
|
95
|
+
const languageHref = alternateHref
|
|
96
|
+
? new URL(alternateHref, Astro.site ?? new URL(${JSON.stringify(PLACEHOLDER_SITE_URL)})).pathname
|
|
97
|
+
: undefined;
|
|
98
|
+
---
|
|
99
|
+
<!doctype html>
|
|
100
|
+
<html lang={currentLang}>
|
|
101
|
+
<head>
|
|
102
|
+
<meta charset="utf-8" />
|
|
103
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
104
|
+
<SeoHead title={title} description={description} ogImage={image}
|
|
105
|
+
pathname={Astro.url.pathname} locale={currentLang} siteName={siteName} alternates={alternates} />
|
|
106
|
+
</head>
|
|
107
|
+
<body>
|
|
108
|
+
<PageShell lang={currentLang}>
|
|
109
|
+
<Header
|
|
110
|
+
slot="header"
|
|
111
|
+
lang={currentLang}
|
|
112
|
+
siteName={siteName}
|
|
113
|
+
navItems={navItems}
|
|
114
|
+
currentLang={currentLang}
|
|
115
|
+
pathname={Astro.url.pathname}
|
|
116
|
+
brandHref={basePath + (currentLang === ${JSON.stringify(options.defaultLocale)} ? '/' : '/' + currentLang + '/')}
|
|
117
|
+
alternateHref={languageHref}
|
|
118
|
+
locales={locales}
|
|
119
|
+
/>
|
|
120
|
+
<slot />
|
|
121
|
+
<Footer slot="footer" lang={currentLang} siteName={siteName} legalLinks={[
|
|
122
|
+
{ label: currentLang === 'de' ? 'Impressum (Beispiel)' : 'Imprint (sample)', href: basePath + '/imprint' },
|
|
123
|
+
{ label: currentLang === 'de' ? 'Datenschutz (Beispiel)' : 'Privacy (sample)', href: basePath + '/privacy' },
|
|
124
|
+
]} />
|
|
125
|
+
</PageShell>
|
|
126
|
+
</body>
|
|
127
|
+
</html>
|
|
128
|
+
`;
|
|
129
|
+
}
|
|
53
130
|
return `---
|
|
54
131
|
import PageShell from '@easy-web/core/components/PageShell.astro';
|
|
55
132
|
import Header from '@easy-web/core/components/Header.astro';
|
|
@@ -130,16 +207,53 @@ dist
|
|
|
130
207
|
.astro
|
|
131
208
|
`;
|
|
132
209
|
|
|
210
|
+
function localizedHomePage(options: ShellRecipeOptions, locale: string, locales: readonly string[]): string {
|
|
211
|
+
return `---
|
|
212
|
+
import Base from '${locale === options.defaultLocale ? '../layouts/Base.astro' : '../../layouts/Base.astro'}';
|
|
213
|
+
import { getAlternateLinks, ambientTrailingSlash } from '@easy-web/core/i18n';
|
|
214
|
+
|
|
215
|
+
const localizedPaths = [Object.fromEntries(${JSON.stringify(locales)}.map((itemLocale) => [
|
|
216
|
+
itemLocale, itemLocale === ${JSON.stringify(options.defaultLocale)} ? '/' : '/' + itemLocale + '/',
|
|
217
|
+
]))];
|
|
218
|
+
const routePath = ${JSON.stringify(locale === options.defaultLocale ? '/' : `/${locale}/`)};
|
|
219
|
+
const pagePath = Astro.url.pathname.replace(/\\/+$/, '') || '/';
|
|
220
|
+
const routeWithoutSlash = routePath.replace(/\\/+$/, '') || '/';
|
|
221
|
+
const sitePrefix = routeWithoutSlash === '/' ? (pagePath === '/' ? '' : pagePath)
|
|
222
|
+
: pagePath.endsWith(routeWithoutSlash) ? pagePath.slice(0, -routeWithoutSlash.length) : '';
|
|
223
|
+
const alternates = getAlternateLinks({
|
|
224
|
+
path: routePath, locales: ${JSON.stringify(locales)},
|
|
225
|
+
defaultLocale: ${JSON.stringify(options.defaultLocale)},
|
|
226
|
+
baseUrl: new URL(sitePrefix ? sitePrefix + '/' : '/', Astro.site?.toString() ?? ${JSON.stringify(PLACEHOLDER_SITE_URL)}).toString(),
|
|
227
|
+
localizedPaths,
|
|
228
|
+
trailingSlash: ambientTrailingSlash(),
|
|
229
|
+
});
|
|
230
|
+
const alternateHref = alternates.find(({ hreflang }) => hreflang !== ${JSON.stringify(locale)} && hreflang !== 'x-default')?.href;
|
|
231
|
+
---
|
|
232
|
+
<Base title={${JSON.stringify(options.siteName)}} locale={${JSON.stringify(locale)}} basePath={sitePrefix} alternates={alternates} alternateHref={alternateHref}>
|
|
233
|
+
<h1>${locale === 'de' ? 'Willkommen' : 'Welcome'}</h1>
|
|
234
|
+
<p>${locale === 'de' ? 'Dies ist eine generierte Platzhalter-Startseite. Ersetze diesen Inhalt vor der Veröffentlichung.' : 'This is a generated placeholder home page. Replace this content before production.'}</p>
|
|
235
|
+
</Base>
|
|
236
|
+
`;
|
|
237
|
+
}
|
|
238
|
+
|
|
133
239
|
export function buildShellFiles(rawOptions: unknown, navigation: readonly NavItem[] = [], configuration: ShellConfiguration = {}): readonly { path: string; content: string }[] {
|
|
134
240
|
const options = shellOptionsSchema.parse(rawOptions ?? {});
|
|
241
|
+
const locales = configuration.contentLocales;
|
|
242
|
+
const multilingual = !!locales && locales.length > 1;
|
|
135
243
|
return [
|
|
136
244
|
{ path: 'astro.config.mjs', content: astroConfig(options, configuration) },
|
|
137
245
|
{ path: 'package.json', content: packageJsonFragment },
|
|
138
246
|
{ path: 'pnpm-workspace.yaml', content: pnpmWorkspace },
|
|
139
|
-
{ path: 'src/layouts/Base.astro', content: baseLayout(options, navigation) },
|
|
140
|
-
{ path: 'src/pages/index.astro', content: homePage(options) },
|
|
247
|
+
{ path: 'src/layouts/Base.astro', content: baseLayout(options, navigation, configuration) },
|
|
248
|
+
{ path: 'src/pages/index.astro', content: multilingual ? localizedHomePage(options, options.defaultLocale, locales!) : homePage(options) },
|
|
249
|
+
...(multilingual ? locales!.slice(1).map((locale) => ({
|
|
250
|
+
path: `src/pages/${locale}/index.astro`,
|
|
251
|
+
content: localizedHomePage(options, locale, locales!),
|
|
252
|
+
})) : []),
|
|
141
253
|
{ path: 'src/pages/404.astro', content: notFoundPage(options) },
|
|
142
|
-
{ path: 'src/lib/localized-paths.ts', content:
|
|
254
|
+
{ path: 'src/lib/localized-paths.ts', content: multilingual
|
|
255
|
+
? `import type { LocalizedPathGroup } from '@easy-web/core/i18n';\n\nexport const localizedPaths: readonly LocalizedPathGroup[] = ${JSON.stringify(configuration.localizedPaths ?? [], null, 2)};\n`
|
|
256
|
+
: localizedPaths },
|
|
143
257
|
{ path: 'tsconfig.json', content: `${JSON.stringify({ extends: 'astro/tsconfigs/strict', include: ['.astro/types.d.ts', '**/*'], exclude: ['dist'] }, null, 2)}\n` },
|
|
144
258
|
{ path: '.gitignore', content: gitignore },
|
|
145
259
|
];
|
|
@@ -149,7 +263,7 @@ export const shellRecipe = {
|
|
|
149
263
|
id: SHELL_RECIPE_ID,
|
|
150
264
|
version: '1.5.0',
|
|
151
265
|
protocolVersion: 1,
|
|
152
|
-
compatibleCliRange: '^0.1.0 || ^0.2.0',
|
|
266
|
+
compatibleCliRange: '^0.1.0 || ^0.2.0 || ^0.3.0',
|
|
153
267
|
compatibleRuntimeRange: '^1.5.0',
|
|
154
268
|
provides: [SHELL_RECIPE_ID],
|
|
155
269
|
requires: [],
|
|
@@ -163,6 +163,34 @@ describe('easyWebSeo integration factory', () => {
|
|
|
163
163
|
);
|
|
164
164
|
});
|
|
165
165
|
|
|
166
|
+
it('does not install the sitemap reconciliation hook when noIndex is enabled', () => {
|
|
167
|
+
const integration = easyWebSeo({
|
|
168
|
+
noIndex: true,
|
|
169
|
+
synchronizeRenderedAlternates: true,
|
|
170
|
+
localizedPaths: [{ de: '/', en: '/en/' }],
|
|
171
|
+
sitemapLocales: { de: 'de', en: 'en' },
|
|
172
|
+
});
|
|
173
|
+
const mockConfig = {
|
|
174
|
+
site: new URL('https://example.com'),
|
|
175
|
+
base: '/',
|
|
176
|
+
trailingSlash: 'always',
|
|
177
|
+
build: { format: 'directory' },
|
|
178
|
+
i18n: { locales: ['de', 'en'], defaultLocale: 'de', routing: {} },
|
|
179
|
+
integrations: [],
|
|
180
|
+
};
|
|
181
|
+
const updateConfig = vi.fn();
|
|
182
|
+
|
|
183
|
+
getConfigSetupHook(integration)({
|
|
184
|
+
config: mockConfig,
|
|
185
|
+
updateConfig,
|
|
186
|
+
injectRoute: vi.fn(),
|
|
187
|
+
logger: { error: vi.fn(), warn: vi.fn(), info: vi.fn() },
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
expect(process.env.EASY_WEB_SEO_NO_INDEX).toBe('true');
|
|
191
|
+
expect(updateConfig).not.toHaveBeenCalled();
|
|
192
|
+
});
|
|
193
|
+
|
|
166
194
|
it('handles Astro path-style locales (objects with .path) when falling back to language-only tags', () => {
|
|
167
195
|
const integration = easyWebSeo();
|
|
168
196
|
const mockConfig = {
|