@easy-web/core 1.9.1 → 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 +25 -6
- 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 +209 -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 +79 -2
- package/src/recipes/__tests__/shell-recipe.test.ts +23 -0
- package/src/recipes/content-site.ts +212 -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,9 +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
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
|
+
}
|
|
13
19
|
|
|
14
20
|
export interface ContentSiteOptions {
|
|
15
21
|
readonly mediaFolder?: string;
|
|
@@ -17,13 +23,16 @@ export interface ContentSiteOptions {
|
|
|
17
23
|
}
|
|
18
24
|
|
|
19
25
|
export const generatedContentCompositionSchema = contentCompositionSchema.superRefine((composition, context) => {
|
|
20
|
-
|
|
21
|
-
|
|
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' });
|
|
22
30
|
}
|
|
23
31
|
if (!composition.contentTypes.length) {
|
|
24
32
|
context.addIssue({ code: 'custom', path: ['contentTypes'], message: 'Content generation requires at least one content type' });
|
|
25
33
|
}
|
|
26
34
|
const routes: string[] = [];
|
|
35
|
+
const localeRoots = new Set(locales.slice(1).map((locale) => `/${locale}`));
|
|
27
36
|
composition.contentTypes.forEach((type, index) => {
|
|
28
37
|
const path = ['contentTypes', index];
|
|
29
38
|
for (const trait of type.traits) {
|
|
@@ -41,7 +50,10 @@ export const generatedContentCompositionSchema = contentCompositionSchema.superR
|
|
|
41
50
|
|| defaultReservedContentRoutes.some((reserved) => reserved !== '/' && `${base}/`.startsWith(reserved))) {
|
|
42
51
|
context.addIssue({ code: 'custom', path: [...path, 'routes'], message: `Unsupported generated content route "${route}"; use non-reserved lowercase path segments` });
|
|
43
52
|
}
|
|
44
|
-
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}/`))) {
|
|
45
57
|
context.addIssue({ code: 'custom', path: [...path, 'routes'], message: `Generated list/detail routes overlap at "${route}"` });
|
|
46
58
|
}
|
|
47
59
|
routes.push(base);
|
|
@@ -53,12 +65,17 @@ function routeBase(type: ContentTypeDefinition, locale: string): string {
|
|
|
53
65
|
return type.routes[locale]!.replace(/\/$/, '');
|
|
54
66
|
}
|
|
55
67
|
|
|
56
|
-
function collectionSchema(type: ContentTypeDefinition): string {
|
|
68
|
+
function collectionSchema(type: ContentTypeDefinition, locales: readonly string[]): string {
|
|
57
69
|
const shapes = ['...titleTraitSchema.unwrap().shape', '...slugTraitSchema.unwrap().shape'];
|
|
58
70
|
if (type.traits.includes('summary')) shapes.push('...summaryTraitSchema.unwrap().shape');
|
|
59
71
|
if (type.traits.includes('image')) {
|
|
60
72
|
shapes.push('image: imageTraitSchema.unwrap().shape.image.unwrap().extend({ src: image() })');
|
|
61
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');
|
|
62
79
|
// File-based IDs keep duplicate public slugs visible to route validation.
|
|
63
80
|
return `${JSON.stringify(type.id)}: defineCollection({
|
|
64
81
|
loader: glob({ pattern: '**/*.md', base: ${JSON.stringify(`./src/content/${type.id}`)}, generateId: ({ entry }) => entry.replace(/\\.md$/, '') }),
|
|
@@ -66,40 +83,86 @@ function collectionSchema(type: ContentTypeDefinition): string {
|
|
|
66
83
|
})`;
|
|
67
84
|
}
|
|
68
85
|
|
|
69
|
-
function adapterSource(type: ContentTypeDefinition,
|
|
70
|
-
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;
|
|
71
97
|
return `import type { CollectionEntry } from 'astro:content';
|
|
72
98
|
import { assertImplements, type Item, type Linkable, ${contracts.map((name) => `type ${name}`).join(', ')} } from '@easy-web/core/contracts';
|
|
73
99
|
import { composition } from '../../content/definitions';
|
|
74
100
|
|
|
75
101
|
type Entry = CollectionEntry<${JSON.stringify(type.id)}>;
|
|
76
102
|
assertImplements<Entry['data'], ${contracts.join(' & ')}>();
|
|
77
|
-
|
|
78
|
-
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 {
|
|
79
105
|
const data = entry.data;
|
|
80
106
|
return {
|
|
81
107
|
title: data.title,
|
|
82
108
|
${type.traits.includes('summary') ? 'description: data.summary,' : ''}
|
|
83
109
|
${type.traits.includes('image') ? 'image: data.image,' : ''}
|
|
84
|
-
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 + '/',
|
|
85
111
|
};
|
|
86
112
|
}
|
|
87
113
|
`;
|
|
88
114
|
}
|
|
89
115
|
|
|
90
|
-
function listSource(type: ContentTypeDefinition, locale: string): string {
|
|
116
|
+
function listSource(type: ContentTypeDefinition, locale: string, composition: ContentComposition): string {
|
|
91
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)`;
|
|
92
151
|
return `---
|
|
93
152
|
import { getCollection } from 'astro:content';
|
|
94
153
|
import Base from '${prefix}layouts/Base.astro';
|
|
95
154
|
import { toItem } from '${prefix}lib/content/${type.id}';
|
|
155
|
+
${type.traits.includes('order') ? "import { compareContentOrder } from '@easy-web/core/contracts';" : ''}
|
|
96
156
|
import Card from '@easy-web/core/components/Card.astro';
|
|
97
157
|
import CardGrid from '@easy-web/core/components/CardGrid.astro';
|
|
158
|
+
${localized ? "import { getAlternateLinks, ambientTrailingSlash } from '@easy-web/core/i18n';" : ''}
|
|
98
159
|
|
|
99
|
-
|
|
100
|
-
|
|
160
|
+
${localizedBaseSetup}
|
|
161
|
+
const items = (await getCollection(${JSON.stringify(type.id)}${localeFilter}))
|
|
162
|
+
${itemMapping};
|
|
163
|
+
${alternateSetup}
|
|
101
164
|
---
|
|
102
|
-
<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}` : ''}>
|
|
103
166
|
<h1>{${JSON.stringify(type.labels[locale])}}</h1>
|
|
104
167
|
<CardGrid>
|
|
105
168
|
{items.map((item) => <Card item={item} />)}
|
|
@@ -108,32 +171,84 @@ const items = (await getCollection(${JSON.stringify(type.id)}))
|
|
|
108
171
|
`;
|
|
109
172
|
}
|
|
110
173
|
|
|
111
|
-
function detailSource(type: ContentTypeDefinition, locale: string): string {
|
|
174
|
+
function detailSource(type: ContentTypeDefinition, locale: string, composition: ContentComposition): string {
|
|
112
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)}` : '';
|
|
113
205
|
return `---
|
|
114
206
|
import { getCollection, render, type CollectionEntry } from 'astro:content';
|
|
115
207
|
import type { Rendered, Item, Linkable } from '@easy-web/core/contracts';
|
|
116
208
|
import Base from '${prefix}layouts/Base.astro';
|
|
117
209
|
import { toItem } from '${prefix}lib/content/${type.id}';
|
|
118
210
|
import Prose from '@easy-web/core/components/Prose.astro';
|
|
211
|
+
${localized ? "import { getAlternateLinks, ambientTrailingSlash } from '@easy-web/core/i18n';" : ''}
|
|
119
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 };
|
|
120
215
|
|
|
121
|
-
export async function getStaticPaths() {
|
|
122
|
-
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'};
|
|
123
219
|
const seen = new Set<string>();
|
|
220
|
+
${localizedSetup}
|
|
124
221
|
return entries.map((entry) => {
|
|
125
222
|
if (seen.has(entry.data.slug)) throw new Error('Duplicate content slug: ' + entry.data.slug);
|
|
126
223
|
seen.add(entry.data.slug);
|
|
127
|
-
|
|
128
|
-
});
|
|
224
|
+
${localizedMap} });
|
|
129
225
|
}
|
|
130
226
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
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)) };
|
|
134
249
|
const { Content } = rendered;
|
|
135
250
|
---
|
|
136
|
-
<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)}' : ''}>
|
|
137
252
|
<Prose>
|
|
138
253
|
<h1>{rendered.title}</h1>
|
|
139
254
|
{rendered.description && <p>{rendered.description}</p>}
|
|
@@ -145,24 +260,26 @@ const { Content } = rendered;
|
|
|
145
260
|
}
|
|
146
261
|
|
|
147
262
|
function contentFiles(composition: ContentComposition, options: ContentSiteOptions): readonly RecipeGeneratedFile[] {
|
|
148
|
-
const
|
|
263
|
+
const locales = composition.contentLocales;
|
|
264
|
+
const localized = locales.length > 1;
|
|
265
|
+
const runtimeRange = contentRuntimeFor(composition);
|
|
149
266
|
const mediaFolder = z.string().regex(/^src\/assets(?:\/[a-z0-9]+(?:-[a-z0-9]+)*)*$/)
|
|
150
267
|
.parse(options.mediaFolder ?? 'src/assets');
|
|
151
268
|
const exampleImage = `${mediaFolder}/content-example.svg`;
|
|
152
269
|
const files: RecipeGeneratedFile[] = [
|
|
153
270
|
{ path: 'src/content/definitions.ts', content: `import { defineCollection, z } from 'astro:content';
|
|
154
271
|
import { glob } from 'astro/loaders';
|
|
155
|
-
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';
|
|
156
273
|
|
|
157
274
|
export const composition = ${JSON.stringify(composition, null, 2)} as const;
|
|
158
275
|
|
|
159
276
|
export const collections = {
|
|
160
|
-
${composition.contentTypes.map(collectionSchema).join(',\n ')},
|
|
277
|
+
${composition.contentTypes.map((type) => collectionSchema(type, locales)).join(',\n ')},
|
|
161
278
|
};
|
|
162
279
|
` },
|
|
163
280
|
{ path: 'src/content.config.ts', content: "export { collections } from './content/definitions';\n" },
|
|
164
281
|
{ path: 'package.json', content: `${JSON.stringify({ dependencies: {
|
|
165
|
-
'@easy-web/core':
|
|
282
|
+
'@easy-web/core': runtimeRange,
|
|
166
283
|
...(composition.contentTypes.some((type) => type.traits.includes('image')) ? { sharp: '^0.35.0' } : {}),
|
|
167
284
|
} }, null, 2)}\n` },
|
|
168
285
|
];
|
|
@@ -170,19 +287,35 @@ export const collections = {
|
|
|
170
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' });
|
|
171
288
|
}
|
|
172
289
|
for (const [index, type] of composition.contentTypes.entries()) {
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
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
|
+
}
|
|
186
319
|
}
|
|
187
320
|
return files;
|
|
188
321
|
}
|
|
@@ -193,7 +326,24 @@ export function createContentSiteRecipes(rawComposition: unknown, options: Conte
|
|
|
193
326
|
readonly content: RecipeMetadata;
|
|
194
327
|
} {
|
|
195
328
|
const composition = generatedContentCompositionSchema.parse(rawComposition);
|
|
196
|
-
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
|
+
: [];
|
|
197
347
|
const files = contentFiles(composition, options);
|
|
198
348
|
const contributions: RecipeOutputContribution[] = files
|
|
199
349
|
.filter(({ path }) => !path.startsWith('src/pages/'))
|
|
@@ -201,25 +351,39 @@ export function createContentSiteRecipes(rawComposition: unknown, options: Conte
|
|
|
201
351
|
for (const type of composition.contentTypes) {
|
|
202
352
|
contributions.push(
|
|
203
353
|
{ kind: 'content', id: `content.type.${type.id}`, target: type.primary ? 'primary' : 'additional' },
|
|
204
|
-
|
|
205
|
-
|
|
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
|
+
]),
|
|
206
358
|
...type.bindings.map((binding) => ({ kind: 'binding' as const, id: `content.binding.${type.id}.${binding}`, target: `content.type.${type.id}` })),
|
|
207
359
|
);
|
|
208
360
|
}
|
|
209
|
-
const
|
|
210
|
-
|
|
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;
|
|
211
369
|
return {
|
|
212
370
|
shell: {
|
|
213
371
|
...shellRecipe,
|
|
372
|
+
outputContributions: shellOutputContributions,
|
|
214
373
|
validators: [{
|
|
215
374
|
id: 'shell.content-locale', phase: 'options',
|
|
216
|
-
validate: ({ options }) =>
|
|
375
|
+
validate: ({ options: shellOptions }) => shellOptions.defaultLocale === locale ? [] : [{ code: 'CONTENT_LOCALE_MISMATCH', message: 'shell.defaultLocale must match the content composition locale' }],
|
|
217
376
|
}],
|
|
218
|
-
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
|
+
}),
|
|
219
383
|
},
|
|
220
384
|
content: {
|
|
221
385
|
id: 'content.pages', version: '1.7.1', protocolVersion: 1,
|
|
222
|
-
compatibleCliRange: '^0.1.0 || ^0.2.0', compatibleRuntimeRange:
|
|
386
|
+
compatibleCliRange: '^0.1.0 || ^0.2.0 || ^0.3.0', compatibleRuntimeRange: runtimeRange,
|
|
223
387
|
provides: ['content.pages', 'content.typed-definitions'], requires: ['site.shell'], conflicts: [],
|
|
224
388
|
order: { priority: 10, key: 'content' }, optionsSchema: z.strictObject({}),
|
|
225
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 = {
|