@justanarthur/payload-www 0.3.3 → 0.3.4
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/dist/access.js +13 -3
- package/dist/blocks.js +21 -7
- package/dist/collections.js +72 -19
- package/dist/components.js +1 -0
- package/dist/config.js +108 -26
- package/dist/core-access.js +13 -3
- package/dist/core-blocks.js +21 -7
- package/dist/core-fields.js +21 -7
- package/dist/core-utils.js +20 -6
- package/dist/data-collections.js +72 -19
- package/dist/data-test.js +108 -26
- package/dist/fields.js +21 -7
- package/dist/globals.js +18 -1
- package/dist/hooks.js +47 -15
- package/dist/index.js +1 -0
- package/dist/metadata.js +68 -22
- package/dist/pages.js +133 -41
- package/dist/render-components.js +13 -3
- package/dist/render-metadata.js +68 -22
- package/dist/render-pages.js +206 -61
- package/dist/render-utils.js +62 -16
- package/dist/server.js +228 -71
- package/dist/test.js +108 -26
- package/dist/utils.js +20 -6
- package/dist/with-www-config.js +108 -26
- package/package.json +1 -1
package/dist/render-pages.js
CHANGED
|
@@ -30,6 +30,7 @@ function PageShowcase({
|
|
|
30
30
|
metadataHeading = "Page metadata",
|
|
31
31
|
jsonLdHeading = "JSON-LD"
|
|
32
32
|
}) {
|
|
33
|
+
console.log("[WWW] render/components:PageShowcase jsonLdEntries=", jsonLd.length, "hasOg=", Boolean(metadata.openGraph), "hasTwitter=", Boolean(metadata.twitter), "canonical=", metadata.alternates?.canonical);
|
|
33
34
|
const og = metadata.openGraph;
|
|
34
35
|
const twitter = metadata.twitter;
|
|
35
36
|
const rows = [
|
|
@@ -147,6 +148,7 @@ function LocaleSwitcher({
|
|
|
147
148
|
labels
|
|
148
149
|
}) {
|
|
149
150
|
const locales = Object.keys(hreflangAlternates).filter((k) => k !== "x-default");
|
|
151
|
+
console.log("[WWW] render/components:LocaleSwitcher currentLocale=", currentLocale, "locales=", JSON.stringify(locales), "hasXDefault=", Boolean(hreflangAlternates["x-default"]));
|
|
150
152
|
return /* @__PURE__ */ jsx5("nav", {
|
|
151
153
|
"aria-label": "Language",
|
|
152
154
|
className: "locale-switcher",
|
|
@@ -200,20 +202,27 @@ var STATIC_PAGES_SLUG = "staticPages";
|
|
|
200
202
|
|
|
201
203
|
// src/core/utils/getFromImportMap.ts
|
|
202
204
|
function getFromImportMap(key, importMap) {
|
|
203
|
-
|
|
205
|
+
const resolvedKey = key.includes("#") ? key : key + "#default";
|
|
206
|
+
const value = importMap[resolvedKey];
|
|
207
|
+
console.log("[WWW] core/utils:getFromImportMap key=", key, "resolved=", resolvedKey, "hit=", Boolean(value));
|
|
208
|
+
return value;
|
|
204
209
|
}
|
|
205
210
|
|
|
206
211
|
// src/render/utils/renderCollectionModule.tsx
|
|
207
212
|
import { jsx } from "react/jsx-runtime";
|
|
208
213
|
function renderCollectionModule(collection = [], slug, importMap, props) {
|
|
209
214
|
const renderPath = collection?.find((c) => c.slug === slug)?.custom?.path;
|
|
210
|
-
if (!renderPath)
|
|
215
|
+
if (!renderPath) {
|
|
216
|
+
console.log("[WWW] render/utils:renderCollectionModule no custom.path slug=", slug);
|
|
211
217
|
return null;
|
|
218
|
+
}
|
|
212
219
|
const CollectionRenderModule = getFromImportMap(renderPath, importMap);
|
|
213
220
|
if (!CollectionRenderModule) {
|
|
221
|
+
console.error("[WWW] render/utils:renderCollectionModule not found slug=", slug, "path=", renderPath);
|
|
214
222
|
if (false) {}
|
|
215
223
|
return null;
|
|
216
224
|
}
|
|
225
|
+
console.log("[WWW] render/utils:renderCollectionModule rendering slug=", slug, "path=", renderPath);
|
|
217
226
|
return /* @__PURE__ */ jsx(CollectionRenderModule, {
|
|
218
227
|
importMap,
|
|
219
228
|
...props
|
|
@@ -234,6 +243,7 @@ async function buildHreflangAlternates({
|
|
|
234
243
|
localePrefix = "always"
|
|
235
244
|
}) {
|
|
236
245
|
const allLocaleSlugs = await queryAllLocaleSlugs(storedSlug, locale);
|
|
246
|
+
console.log("[WWW] render/metadata:buildHreflangAlternates storedSlug=", storedSlug, "locale=", locale, "allLocaleSlugs=", JSON.stringify(allLocaleSlugs));
|
|
237
247
|
const languages = {};
|
|
238
248
|
const urlFor = (l, slug) => {
|
|
239
249
|
const trimmedPrefix = urlPrefix.replace(/^\/|\/$/g, "");
|
|
@@ -251,6 +261,7 @@ async function buildHreflangAlternates({
|
|
|
251
261
|
if (allLocaleSlugs?.[defaultLocale]) {
|
|
252
262
|
languages["x-default"] = urlFor(defaultLocale, allLocaleSlugs[defaultLocale]);
|
|
253
263
|
}
|
|
264
|
+
console.log("[WWW] render/metadata:buildHreflangAlternates ->", JSON.stringify(languages));
|
|
254
265
|
return languages;
|
|
255
266
|
}
|
|
256
267
|
|
|
@@ -265,6 +276,11 @@ function getImageUrl(doc, siteUrl) {
|
|
|
265
276
|
return img.url.startsWith("http") ? img.url : `${siteUrl}${img.url}`;
|
|
266
277
|
return null;
|
|
267
278
|
}
|
|
279
|
+
function getImageUrlWithLog(doc, siteUrl) {
|
|
280
|
+
const result = getImageUrl(doc, siteUrl);
|
|
281
|
+
console.log("[WWW] render/metadata:jsonld:getImageUrl ->", result);
|
|
282
|
+
return result;
|
|
283
|
+
}
|
|
268
284
|
function resolveLocalizedField(value, locale) {
|
|
269
285
|
if (value == null)
|
|
270
286
|
return "";
|
|
@@ -286,6 +302,13 @@ function resolveLocalizedField(value, locale) {
|
|
|
286
302
|
}
|
|
287
303
|
return Object.values(obj).filter((v) => typeof v === "string" && v.length > 0).join(" / ");
|
|
288
304
|
}
|
|
305
|
+
function resolveLocalizedFieldWithLog(value, locale) {
|
|
306
|
+
const result = resolveLocalizedField(value, locale);
|
|
307
|
+
if (value && typeof value === "object") {
|
|
308
|
+
console.log("[WWW] render/metadata:jsonld:resolveLocalizedField locale=", locale, "->", JSON.stringify(result));
|
|
309
|
+
}
|
|
310
|
+
return result;
|
|
311
|
+
}
|
|
289
312
|
function buildArticleLd({
|
|
290
313
|
doc,
|
|
291
314
|
url,
|
|
@@ -296,12 +319,13 @@ function buildArticleLd({
|
|
|
296
319
|
publisherLogo
|
|
297
320
|
}) {
|
|
298
321
|
const name = publisherName ?? new URL(siteUrl).hostname;
|
|
322
|
+
console.log("[WWW] render/metadata:buildArticleLd url=", url, "locale=", locale, "type=", type, "publisherName=", name);
|
|
299
323
|
const ld = {
|
|
300
324
|
"@context": "https://schema.org",
|
|
301
325
|
"@type": type,
|
|
302
326
|
"@id": `${url}#article`,
|
|
303
|
-
headline:
|
|
304
|
-
description:
|
|
327
|
+
headline: resolveLocalizedFieldWithLog(doc.title, locale),
|
|
328
|
+
description: resolveLocalizedFieldWithLog(doc.meta?.description ?? doc.description ?? doc.excerpt, locale),
|
|
305
329
|
inLanguage: locale,
|
|
306
330
|
url,
|
|
307
331
|
dateModified: doc.updatedAt ? new Date(doc.updatedAt).toISOString() : undefined
|
|
@@ -309,7 +333,7 @@ function buildArticleLd({
|
|
|
309
333
|
const datePublished = doc.publishedAt ?? doc.createdAt;
|
|
310
334
|
if (datePublished)
|
|
311
335
|
ld.datePublished = new Date(datePublished).toISOString();
|
|
312
|
-
const imgUrl =
|
|
336
|
+
const imgUrl = getImageUrlWithLog(doc, siteUrl);
|
|
313
337
|
if (imgUrl)
|
|
314
338
|
ld.image = imgUrl;
|
|
315
339
|
ld.author = { "@type": "Organization", name, url: siteUrl };
|
|
@@ -325,6 +349,7 @@ function buildBreadcrumbsLd({
|
|
|
325
349
|
items,
|
|
326
350
|
currentUrl
|
|
327
351
|
}) {
|
|
352
|
+
console.log("[WWW] render/metadata:buildBreadcrumbsLd items=", items.length, "currentUrl=", currentUrl);
|
|
328
353
|
return {
|
|
329
354
|
"@context": "https://schema.org",
|
|
330
355
|
"@type": "BreadcrumbList",
|
|
@@ -342,6 +367,7 @@ function buildOrganizationLd({
|
|
|
342
367
|
logo,
|
|
343
368
|
sameAs
|
|
344
369
|
}) {
|
|
370
|
+
console.log("[WWW] render/metadata:buildOrganizationLd siteUrl=", siteUrl, "name=", name, "logo?", Boolean(logo), "sameAs?", Boolean(sameAs));
|
|
345
371
|
const org = {
|
|
346
372
|
"@context": "https://schema.org",
|
|
347
373
|
"@type": "Organization",
|
|
@@ -357,23 +383,29 @@ function buildOrganizationLd({
|
|
|
357
383
|
// src/render/metadata/slug.ts
|
|
358
384
|
var SLUG_NESTED_DIVIDER = "_";
|
|
359
385
|
function segmentsToStoredSlug(segments, nested) {
|
|
360
|
-
if (!Array.isArray(segments))
|
|
386
|
+
if (!Array.isArray(segments)) {
|
|
387
|
+
console.log("[WWW] render/metadata:segmentsToStoredSlug string passthrough:", JSON.stringify(segments));
|
|
361
388
|
return segments;
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
389
|
+
}
|
|
390
|
+
const result = nested ? segments.join(SLUG_NESTED_DIVIDER) : segments[0] ?? "";
|
|
391
|
+
console.log("[WWW] render/metadata:segmentsToStoredSlug nested=", nested, "segments=", JSON.stringify(segments), "->", result);
|
|
392
|
+
return result;
|
|
365
393
|
}
|
|
366
394
|
function segmentsToUrlPath(segments, nested) {
|
|
395
|
+
let result;
|
|
367
396
|
if (!Array.isArray(segments))
|
|
368
|
-
|
|
369
|
-
if (nested)
|
|
370
|
-
|
|
371
|
-
|
|
397
|
+
result = "/" + segments;
|
|
398
|
+
else if (nested)
|
|
399
|
+
result = "/" + segments.join("/");
|
|
400
|
+
else
|
|
401
|
+
result = "/" + (segments[0] ?? "");
|
|
402
|
+
console.log("[WWW] render/metadata:segmentsToUrlPath nested=", nested, "segments=", JSON.stringify(segments), "->", result);
|
|
403
|
+
return result;
|
|
372
404
|
}
|
|
373
405
|
function storedSlugToSegments(storedSlug, nested) {
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
return
|
|
406
|
+
const result = nested ? storedSlug.split(SLUG_NESTED_DIVIDER) : storedSlug;
|
|
407
|
+
console.log("[WWW] render/metadata:storedSlugToSegments nested=", nested, "storedSlug=", storedSlug, "->", JSON.stringify(result));
|
|
408
|
+
return result;
|
|
377
409
|
}
|
|
378
410
|
function buildCanonicalUrl({
|
|
379
411
|
siteUrl,
|
|
@@ -383,7 +415,9 @@ function buildCanonicalUrl({
|
|
|
383
415
|
}) {
|
|
384
416
|
const trimmedPrefix = urlPrefix.replace(/^\/|\/$/g, "");
|
|
385
417
|
const prefixSegment = trimmedPrefix ? `/${trimmedPrefix}` : "";
|
|
386
|
-
|
|
418
|
+
const result = `${siteUrl}/${locale}${prefixSegment}${urlPath}`;
|
|
419
|
+
console.log("[WWW] render/metadata:buildCanonicalUrl siteUrl=", siteUrl, "locale=", locale, "urlPrefix=", urlPrefix, "urlPath=", urlPath, "->", result);
|
|
420
|
+
return result;
|
|
387
421
|
}
|
|
388
422
|
function getUrlPath(segments, nested, homeSlug) {
|
|
389
423
|
const urlPath = segmentsToUrlPath(segments, nested);
|
|
@@ -409,6 +443,7 @@ var queryDocBySlug = cache(async function queryDocBySlug2({
|
|
|
409
443
|
draft = false,
|
|
410
444
|
config
|
|
411
445
|
}) {
|
|
446
|
+
console.log("[WWW] render/metadata:queryDocBySlug collection=", collectionSlug, "slug=", slug, "slugField=", slugField, "locale=", locale, "draft=", draft);
|
|
412
447
|
const payload = await getPayload({ config });
|
|
413
448
|
const result = await payload.find({
|
|
414
449
|
collection: collectionSlug,
|
|
@@ -419,7 +454,9 @@ var queryDocBySlug = cache(async function queryDocBySlug2({
|
|
|
419
454
|
where: { [slugField]: { equals: slug } },
|
|
420
455
|
locale
|
|
421
456
|
});
|
|
422
|
-
|
|
457
|
+
const doc = result.docs?.[0] ?? null;
|
|
458
|
+
console.log("[WWW] render/metadata:queryDocBySlug ->", doc ? "hit" : "miss");
|
|
459
|
+
return doc;
|
|
423
460
|
});
|
|
424
461
|
var queryAllDocs = cache(async function queryAllDocs2({
|
|
425
462
|
collectionSlug,
|
|
@@ -427,6 +464,7 @@ var queryAllDocs = cache(async function queryAllDocs2({
|
|
|
427
464
|
locale,
|
|
428
465
|
config
|
|
429
466
|
}) {
|
|
467
|
+
console.log("[WWW] render/metadata:queryAllDocs collection=", collectionSlug, "locale=", locale);
|
|
430
468
|
const payload = await getPayload({ config });
|
|
431
469
|
const result = await payload.find({
|
|
432
470
|
collection: collectionSlug,
|
|
@@ -437,7 +475,9 @@ var queryAllDocs = cache(async function queryAllDocs2({
|
|
|
437
475
|
select: { [slugField]: true },
|
|
438
476
|
locale
|
|
439
477
|
});
|
|
440
|
-
|
|
478
|
+
const docs = result.docs ?? [];
|
|
479
|
+
console.log("[WWW] render/metadata:queryAllDocs -> count=", docs.length);
|
|
480
|
+
return docs;
|
|
441
481
|
});
|
|
442
482
|
var queryAllLocaleSlugs = cache(async function queryAllLocaleSlugs2({
|
|
443
483
|
collectionSlug,
|
|
@@ -446,6 +486,7 @@ var queryAllLocaleSlugs = cache(async function queryAllLocaleSlugs2({
|
|
|
446
486
|
locale,
|
|
447
487
|
config
|
|
448
488
|
}) {
|
|
489
|
+
console.log("[WWW] render/metadata:queryAllLocaleSlugs collection=", collectionSlug, "slug=", slug, "locale=", locale);
|
|
449
490
|
const payload = await getPayload({ config });
|
|
450
491
|
const result = await payload.find({
|
|
451
492
|
collection: collectionSlug,
|
|
@@ -458,8 +499,10 @@ var queryAllLocaleSlugs = cache(async function queryAllLocaleSlugs2({
|
|
|
458
499
|
select: { [slugField]: true }
|
|
459
500
|
});
|
|
460
501
|
const doc = result.docs?.[0];
|
|
461
|
-
if (!doc)
|
|
502
|
+
if (!doc) {
|
|
503
|
+
console.log("[WWW] render/metadata:queryAllLocaleSlugs -> undefined (no doc)");
|
|
462
504
|
return;
|
|
505
|
+
}
|
|
463
506
|
let fieldValue = doc[slugField];
|
|
464
507
|
if (doc.id != null) {
|
|
465
508
|
const allLocales = await payload.findByID({
|
|
@@ -474,6 +517,7 @@ var queryAllLocaleSlugs = cache(async function queryAllLocaleSlugs2({
|
|
|
474
517
|
fieldValue = allLocales[slugField];
|
|
475
518
|
}
|
|
476
519
|
if (fieldValue && typeof fieldValue === "object") {
|
|
520
|
+
console.log("[WWW] render/metadata:queryAllLocaleSlugs -> localized map=", JSON.stringify(fieldValue));
|
|
477
521
|
return fieldValue;
|
|
478
522
|
}
|
|
479
523
|
const resolved = await config;
|
|
@@ -481,6 +525,7 @@ var queryAllLocaleSlugs = cache(async function queryAllLocaleSlugs2({
|
|
|
481
525
|
const out = {};
|
|
482
526
|
for (const l of rawLocales)
|
|
483
527
|
out[l] = String(fieldValue ?? slug);
|
|
528
|
+
console.log("[WWW] render/metadata:queryAllLocaleSlugs -> flat-fanout locales=", rawLocales.length, "slug=", JSON.stringify(fieldValue ?? slug));
|
|
484
529
|
return out;
|
|
485
530
|
});
|
|
486
531
|
var queryGlobal = cache(async function queryGlobal2({
|
|
@@ -490,6 +535,7 @@ var queryGlobal = cache(async function queryGlobal2({
|
|
|
490
535
|
draft = false,
|
|
491
536
|
config
|
|
492
537
|
}) {
|
|
538
|
+
console.log("[WWW] render/metadata:queryGlobal global=", globalSlug, "locale=", locale, "depth=", depth, "draft=", draft);
|
|
493
539
|
const payload = await getPayload({ config });
|
|
494
540
|
try {
|
|
495
541
|
const global = await payload.findGlobal({
|
|
@@ -498,17 +544,23 @@ var queryGlobal = cache(async function queryGlobal2({
|
|
|
498
544
|
draft,
|
|
499
545
|
locale
|
|
500
546
|
});
|
|
547
|
+
console.log("[WWW] render/metadata:queryGlobal -> hit");
|
|
501
548
|
return global;
|
|
502
|
-
} catch {
|
|
549
|
+
} catch (error) {
|
|
550
|
+
console.warn("[WWW] render/metadata:queryGlobal failed for slug=", globalSlug, "err=", String(error));
|
|
503
551
|
return null;
|
|
504
552
|
}
|
|
505
553
|
});
|
|
506
554
|
function getRenderModuleExports(exportName, collection, importMap) {
|
|
507
555
|
const path = collection?.custom?.path;
|
|
508
|
-
if (!path)
|
|
556
|
+
if (!path) {
|
|
557
|
+
console.log("[WWW] render/metadata:getRenderModuleExports no custom.path exportName=", exportName);
|
|
509
558
|
return;
|
|
559
|
+
}
|
|
510
560
|
const mod = getFromImportMap(path, importMap);
|
|
511
|
-
|
|
561
|
+
const value = mod?.[exportName];
|
|
562
|
+
console.log("[WWW] render/metadata:getRenderModuleExports exportName=", exportName, "path=", path, "hit=", Boolean(value));
|
|
563
|
+
return value;
|
|
512
564
|
}
|
|
513
565
|
|
|
514
566
|
// src/render/pages/createCollectionPageExports.tsx
|
|
@@ -517,11 +569,18 @@ import { RichText } from "@payloadcms/richtext-lexical/react";
|
|
|
517
569
|
// src/core/utils/generateImportName.ts
|
|
518
570
|
function generateImportName(type, slug) {
|
|
519
571
|
switch (type) {
|
|
520
|
-
case "block":
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
return
|
|
572
|
+
case "block": {
|
|
573
|
+
const name = `Block${slug.replace(/(^\w|-\w)/g, (m) => m.replace("-", "").toUpperCase())}#default`;
|
|
574
|
+
console.log("[WWW] core/utils:generateImportName type=block slug=", slug, "->", name);
|
|
575
|
+
return name;
|
|
576
|
+
}
|
|
577
|
+
case "page": {
|
|
578
|
+
const name = `Page${slug.replace(/(^\w|-\w)/g, (m) => m.replace("-", "").toUpperCase())}#default`;
|
|
579
|
+
console.log("[WWW] core/utils:generateImportName type=page slug=", slug, "->", name);
|
|
580
|
+
return name;
|
|
581
|
+
}
|
|
524
582
|
default:
|
|
583
|
+
console.error("[WWW] core/utils:generateImportName unknown type:", type);
|
|
525
584
|
throw new Error(`Unknown type: ${type}`);
|
|
526
585
|
}
|
|
527
586
|
}
|
|
@@ -536,8 +595,11 @@ var RenderBlocks = ({
|
|
|
536
595
|
locale,
|
|
537
596
|
searchParams
|
|
538
597
|
}) => {
|
|
539
|
-
if (!blocks || !Array.isArray(blocks) || blocks.length === 0)
|
|
598
|
+
if (!blocks || !Array.isArray(blocks) || blocks.length === 0) {
|
|
599
|
+
console.log("[WWW] render/blocks:RenderBlocks no blocks (locale=", locale, ")");
|
|
540
600
|
return null;
|
|
601
|
+
}
|
|
602
|
+
console.log("[WWW] render/blocks:RenderBlocks rendering count=", blocks.length, "locale=", locale);
|
|
541
603
|
const rendered = [];
|
|
542
604
|
for (let i = 0;i < blocks.length; i++) {
|
|
543
605
|
const block = blocks[i];
|
|
@@ -545,9 +607,10 @@ var RenderBlocks = ({
|
|
|
545
607
|
const importMapPath = config.admin?.dependencies?.[blockType]?.path ?? generateImportName("block", blockType);
|
|
546
608
|
const Block = getFromImportMap(importMapPath, importMap);
|
|
547
609
|
if (!Block) {
|
|
548
|
-
console.warn(`
|
|
610
|
+
console.warn(`[WWW] render/blocks:RenderBlocks no block for type=${blockType} importMapPath=${importMapPath} (locale=${locale})`);
|
|
549
611
|
continue;
|
|
550
612
|
}
|
|
613
|
+
console.log("[WWW] render/blocks:RenderBlocks [", i, "] blockType=", blockType, "importMapPath=", importMapPath);
|
|
551
614
|
rendered.push(/* @__PURE__ */ jsx2(Block, {
|
|
552
615
|
index: i,
|
|
553
616
|
...blockProps,
|
|
@@ -564,9 +627,12 @@ var RenderBlocks = ({
|
|
|
564
627
|
// src/render/pages/PagesPage.tsx
|
|
565
628
|
import { jsx as jsx3, Fragment as Fragment2 } from "react/jsx-runtime";
|
|
566
629
|
async function PagesPage({ doc, ...props }) {
|
|
567
|
-
if (!doc)
|
|
630
|
+
if (!doc) {
|
|
631
|
+
console.log("[WWW] render/pages:PagesPage no doc");
|
|
568
632
|
return /* @__PURE__ */ jsx3(Fragment2, {});
|
|
633
|
+
}
|
|
569
634
|
const blocks = doc.blocks ?? [];
|
|
635
|
+
console.log("[WWW] render/pages:PagesPage blocks=", blocks.length, "locale=", props.locale);
|
|
570
636
|
return /* @__PURE__ */ jsx3(Fragment2, {
|
|
571
637
|
children: /* @__PURE__ */ jsx3(RenderBlocks, {
|
|
572
638
|
blocks,
|
|
@@ -604,11 +670,15 @@ function createCollectionPageExports({
|
|
|
604
670
|
const localePrefixMode = typeof routing.localePrefix === "string" ? routing.localePrefix : routing.localePrefix?.mode ?? "always";
|
|
605
671
|
const buildLocalePath = (locale, storedSlug) => {
|
|
606
672
|
const urlPath = getUrlPath(storedSlugToSegments(storedSlug, nested), nested, HOME_SLUG);
|
|
673
|
+
let result;
|
|
607
674
|
if (localePrefixMode === "never")
|
|
608
|
-
|
|
609
|
-
if (localePrefixMode === "as-needed" && locale === defaultLocale)
|
|
610
|
-
|
|
611
|
-
|
|
675
|
+
result = urlPath;
|
|
676
|
+
else if (localePrefixMode === "as-needed" && locale === defaultLocale)
|
|
677
|
+
result = urlPath;
|
|
678
|
+
else
|
|
679
|
+
result = `/${locale}${urlPath}`;
|
|
680
|
+
console.log("[WWW] render/pages:createCollectionPageExports:buildLocalePath locale=", locale, "storedSlug=", storedSlug, "->", result);
|
|
681
|
+
return result;
|
|
612
682
|
};
|
|
613
683
|
async function fetchDoc(locale, storedSlug, draft = false) {
|
|
614
684
|
return queryDocBySlug({
|
|
@@ -639,14 +709,16 @@ function createCollectionPageExports({
|
|
|
639
709
|
for (const [key, url] of Object.entries(languages)) {
|
|
640
710
|
alternates[key] = url;
|
|
641
711
|
}
|
|
712
|
+
console.log("[WWW] render/pages:createCollectionPageExports:resolveHreflangAlternates canonical=", canonical, "alts=", JSON.stringify(alternates));
|
|
642
713
|
return { alternates, canonical };
|
|
643
714
|
}
|
|
644
715
|
const default_ = async (props) => {
|
|
645
716
|
const { slug: rawSlugSegments, locale: incomingLocale } = await props.params ?? {};
|
|
646
717
|
const slugSegments = Array.isArray(rawSlugSegments) ? rawSlugSegments : [];
|
|
647
718
|
const locale = typeof incomingLocale === "string" ? incomingLocale : defaultLocale;
|
|
719
|
+
console.log("[WWW] render/pages:createCollectionPageExports:default_ collectionSlug=", slug, "locale=", locale, "segments=", JSON.stringify(slugSegments), "showcase=", showcaseEnabled);
|
|
648
720
|
if (!locales.includes(locale)) {
|
|
649
|
-
console.error(`[WWW
|
|
721
|
+
console.error(`[WWW] render/pages:createCollectionPageExports:default_ notFound invalid-locale collection=${slug} locale=${locale} segments=${JSON.stringify(slugSegments)}`);
|
|
650
722
|
const { notFound } = await import("next/navigation");
|
|
651
723
|
notFound();
|
|
652
724
|
}
|
|
@@ -654,16 +726,18 @@ function createCollectionPageExports({
|
|
|
654
726
|
setRequestLocale(locale);
|
|
655
727
|
const { draftMode } = await import("next/headers");
|
|
656
728
|
const { isEnabled: draft } = await draftMode();
|
|
729
|
+
console.log("[WWW] render/pages:createCollectionPageExports:default_ draftMode=", draft);
|
|
657
730
|
const storedSlug = segmentsToStoredSlug(slugSegments, nested);
|
|
658
731
|
const doc = await fetchDoc(locale, storedSlug, draft);
|
|
659
732
|
if (!doc) {
|
|
660
|
-
console.error(`[WWW
|
|
733
|
+
console.error(`[WWW] render/pages:createCollectionPageExports:default_ notFound no-doc collection=${slug} locale=${locale} storedSlug="${storedSlug}" segments=${JSON.stringify(slugSegments)} draft=${draft}`);
|
|
661
734
|
const { notFound } = await import("next/navigation");
|
|
662
735
|
notFound();
|
|
663
736
|
}
|
|
664
737
|
const cfg = await configPromise;
|
|
665
738
|
const collectionCustomPath = cfg.collections.find((c) => c.slug === slug)?.custom?.path;
|
|
666
739
|
const effectivePath = renderPath ?? collectionCustomPath ?? defaultRenderPath;
|
|
740
|
+
console.log("[WWW] render/pages:createCollectionPageExports:default_ effectivePath=", effectivePath);
|
|
667
741
|
const render = effectivePath === PAGES_RENDER_PATH ? /* @__PURE__ */ jsx6(PagesPage, {
|
|
668
742
|
doc,
|
|
669
743
|
importMap,
|
|
@@ -725,15 +799,22 @@ function createCollectionPageExports({
|
|
|
725
799
|
const { slug: rawSlugSegments, locale: incomingLocale } = await props.params ?? {};
|
|
726
800
|
const slugSegments = Array.isArray(rawSlugSegments) ? rawSlugSegments : [];
|
|
727
801
|
const locale = typeof incomingLocale === "string" ? incomingLocale : defaultLocale;
|
|
728
|
-
|
|
802
|
+
console.log("[WWW] render/pages:createCollectionPageExports:generateMetadata collectionSlug=", slug, "locale=", locale, "segments=", JSON.stringify(slugSegments));
|
|
803
|
+
if (!locales.includes(locale)) {
|
|
804
|
+
console.log("[WWW] render/pages:createCollectionPageExports:generateMetadata invalid locale -> not found meta");
|
|
729
805
|
return { title: "Not found", robots: { index: false, follow: false } };
|
|
806
|
+
}
|
|
730
807
|
const storedSlug = segmentsToStoredSlug(slugSegments, nested);
|
|
731
808
|
const doc = await fetchDoc(locale, storedSlug);
|
|
732
|
-
if (!doc)
|
|
809
|
+
if (!doc) {
|
|
810
|
+
console.log("[WWW] render/pages:createCollectionPageExports:generateMetadata no doc -> not found meta");
|
|
733
811
|
return { title: "Not found", robots: { index: false, follow: false } };
|
|
812
|
+
}
|
|
734
813
|
const collection = cfg.collections.find((c) => c.slug === slug);
|
|
735
|
-
if (!collection)
|
|
814
|
+
if (!collection) {
|
|
815
|
+
console.warn("[WWW] render/pages:createCollectionPageExports:generateMetadata collection not in config slug=", slug);
|
|
736
816
|
return {};
|
|
817
|
+
}
|
|
737
818
|
const { canonical, alternates } = await resolveHreflangAlternates(locale, storedSlug);
|
|
738
819
|
const meta = await generateMeta({
|
|
739
820
|
doc,
|
|
@@ -755,6 +836,7 @@ function createCollectionPageExports({
|
|
|
755
836
|
const urlPath = buildLocalePath(locale, storedSlug);
|
|
756
837
|
const canonical = `${siteUrl}${urlPath}`;
|
|
757
838
|
const entries = Array.isArray(jsonLdOption) ? jsonLdOption : metadataType === "article" ? [{ type: "article" }] : [{ type: "website" }];
|
|
839
|
+
console.log("[WWW] render/pages:createCollectionPageExports:generateJsonLd collection=", slug, "locale=", locale, "entries=", entries.map((e) => e.type).join(","));
|
|
758
840
|
const outputs = [];
|
|
759
841
|
for (const entry of entries) {
|
|
760
842
|
const id = entry.id ?? `jsonld-${entry.type}-${outputs.length}`;
|
|
@@ -815,6 +897,7 @@ function createCollectionPageExports({
|
|
|
815
897
|
return outputs;
|
|
816
898
|
}
|
|
817
899
|
async function generateStaticParams() {
|
|
900
|
+
console.log("[WWW] render/pages:createCollectionPageExports:generateStaticParams collection=", slug, "locales=", JSON.stringify(locales));
|
|
818
901
|
const params = [];
|
|
819
902
|
for (const locale of locales) {
|
|
820
903
|
const docs = await queryAllDocs({ collectionSlug: slug, slugField: "slug", locale, config: configPromise });
|
|
@@ -826,9 +909,11 @@ function createCollectionPageExports({
|
|
|
826
909
|
params.push({ slug: Array.isArray(segments) ? segments : [segments], locale });
|
|
827
910
|
}
|
|
828
911
|
}
|
|
912
|
+
console.log("[WWW] render/pages:createCollectionPageExports:generateStaticParams -> count=", params.length);
|
|
829
913
|
return params;
|
|
830
914
|
}
|
|
831
915
|
async function generateSitemap() {
|
|
916
|
+
console.log("[WWW] render/pages:createCollectionPageExports:generateSitemap collection=", slug, "locales=", JSON.stringify(locales));
|
|
832
917
|
const docs = await queryAllDocs({
|
|
833
918
|
collectionSlug: slug,
|
|
834
919
|
slugField: "slug",
|
|
@@ -848,6 +933,7 @@ function createCollectionPageExports({
|
|
|
848
933
|
urls.push({ url: `${siteUrl}${urlPath}`, lastModified: lastmod, changeFrequency: changefreq, priority });
|
|
849
934
|
}
|
|
850
935
|
}
|
|
936
|
+
console.log("[WWW] render/pages:createCollectionPageExports:generateSitemap -> urls=", urls.length);
|
|
851
937
|
return urls;
|
|
852
938
|
}
|
|
853
939
|
return {
|
|
@@ -903,13 +989,17 @@ import"server-only";
|
|
|
903
989
|
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
904
990
|
function renderGlobalModule(globals = [], slug, importMap, props) {
|
|
905
991
|
const renderPath = globals?.find((g) => g.slug === slug)?.custom?.path;
|
|
906
|
-
if (!renderPath)
|
|
992
|
+
if (!renderPath) {
|
|
993
|
+
console.log("[WWW] render/utils:renderGlobalModule no custom.path slug=", slug);
|
|
907
994
|
return null;
|
|
995
|
+
}
|
|
908
996
|
const GlobalRenderModule = getFromImportMap(renderPath, importMap);
|
|
909
997
|
if (!GlobalRenderModule) {
|
|
998
|
+
console.error("[WWW] render/utils:renderGlobalModule not found slug=", slug, "path=", renderPath);
|
|
910
999
|
if (false) {}
|
|
911
1000
|
return null;
|
|
912
1001
|
}
|
|
1002
|
+
console.log("[WWW] render/utils:renderGlobalModule rendering slug=", slug, "path=", renderPath);
|
|
913
1003
|
return /* @__PURE__ */ jsx7(GlobalRenderModule, {
|
|
914
1004
|
importMap,
|
|
915
1005
|
...props
|
|
@@ -925,7 +1015,9 @@ function createRootLayoutExports(args) {
|
|
|
925
1015
|
params
|
|
926
1016
|
}) {
|
|
927
1017
|
const { locale } = await params;
|
|
1018
|
+
console.log("[WWW] render/pages:createRootLayoutExports:RootLayout locale=", locale);
|
|
928
1019
|
if (!routing.locales.includes(locale)) {
|
|
1020
|
+
console.error("[WWW] render/pages:createRootLayoutExports:RootLayout invalid locale=", locale);
|
|
929
1021
|
const { notFound } = await import("next/navigation");
|
|
930
1022
|
notFound();
|
|
931
1023
|
}
|
|
@@ -934,11 +1026,13 @@ function createRootLayoutExports(args) {
|
|
|
934
1026
|
const messages = await getMessages();
|
|
935
1027
|
const { draftMode: nextDraftMode } = await import("next/headers");
|
|
936
1028
|
const { isEnabled: draftMode } = await nextDraftMode();
|
|
1029
|
+
console.log("[WWW] render/pages:createRootLayoutExports:RootLayout draftMode=", draftMode);
|
|
937
1030
|
const cfg = await configPromise;
|
|
938
1031
|
const [headerData, footerData] = await Promise.all([
|
|
939
1032
|
queryGlobal({ globalSlug: "header", locale, depth: 0, config: configPromise }),
|
|
940
1033
|
queryGlobal({ globalSlug: "footer", locale, depth: 0, config: configPromise })
|
|
941
1034
|
]);
|
|
1035
|
+
console.log("[WWW] render/pages:createRootLayoutExports:RootLayout header?", Boolean(headerData), "footer?", Boolean(footerData));
|
|
942
1036
|
const headerEl = renderGlobalModule(cfg.globals, "header", importMap, {
|
|
943
1037
|
data: headerData,
|
|
944
1038
|
locale
|
|
@@ -987,40 +1081,65 @@ function createRootLayoutExports(args) {
|
|
|
987
1081
|
import"server-only";
|
|
988
1082
|
|
|
989
1083
|
// src/core/access/index.ts
|
|
990
|
-
var anyone = () =>
|
|
991
|
-
|
|
1084
|
+
var anyone = () => {
|
|
1085
|
+
console.log("[WWW] core/access:anyone -> true");
|
|
1086
|
+
return true;
|
|
1087
|
+
};
|
|
1088
|
+
var authenticated = ({ req: { user } }) => {
|
|
1089
|
+
const result = Boolean(user);
|
|
1090
|
+
console.log("[WWW] core/access:authenticated ->", result);
|
|
1091
|
+
return result;
|
|
1092
|
+
};
|
|
992
1093
|
var authenticatedOrPublished = ({ req: { user } }) => {
|
|
993
|
-
if (user)
|
|
1094
|
+
if (user) {
|
|
1095
|
+
console.log("[WWW] core/access:authenticatedOrPublished -> true (authenticated)");
|
|
994
1096
|
return true;
|
|
1097
|
+
}
|
|
1098
|
+
console.log('[WWW] core/access:authenticatedOrPublished -> { _status: { equals: "published" } }');
|
|
995
1099
|
return { _status: { equals: "published" } };
|
|
996
1100
|
};
|
|
997
1101
|
|
|
998
1102
|
// src/render/_locale.ts
|
|
999
1103
|
function prefixFor(locale, defaultLocale, mode) {
|
|
1104
|
+
let result;
|
|
1000
1105
|
if (mode === "never")
|
|
1001
|
-
|
|
1002
|
-
if (mode === "as-needed" && locale === defaultLocale)
|
|
1003
|
-
|
|
1004
|
-
|
|
1106
|
+
result = "";
|
|
1107
|
+
else if (mode === "as-needed" && locale === defaultLocale)
|
|
1108
|
+
result = "";
|
|
1109
|
+
else
|
|
1110
|
+
result = `/${locale}`;
|
|
1111
|
+
console.log("[WWW] render/_locale:prefixFor locale=", locale, "default=", defaultLocale, "mode=", mode, "->", JSON.stringify(result));
|
|
1112
|
+
return result;
|
|
1005
1113
|
}
|
|
1006
1114
|
function resolveLocale(req) {
|
|
1007
|
-
if (!req || typeof req !== "object")
|
|
1115
|
+
if (!req || typeof req !== "object") {
|
|
1116
|
+
console.log('[WWW] render/_locale:resolveLocale -> "" (no req)');
|
|
1008
1117
|
return "";
|
|
1118
|
+
}
|
|
1009
1119
|
const r = req;
|
|
1010
|
-
if (typeof r.locale === "string" && r.locale.length > 0)
|
|
1120
|
+
if (typeof r.locale === "string" && r.locale.length > 0) {
|
|
1121
|
+
console.log("[WWW] render/_locale:resolveLocale ->", r.locale, "(from req.locale)");
|
|
1011
1122
|
return r.locale;
|
|
1123
|
+
}
|
|
1012
1124
|
const fallback = r.payload?.config?.localization?.defaultLocale;
|
|
1013
|
-
if (typeof fallback === "string" && fallback.length > 0)
|
|
1125
|
+
if (typeof fallback === "string" && fallback.length > 0) {
|
|
1126
|
+
console.log("[WWW] render/_locale:resolveLocale ->", fallback, "(from config.localization.defaultLocale)");
|
|
1014
1127
|
return fallback;
|
|
1128
|
+
}
|
|
1129
|
+
console.log('[WWW] render/_locale:resolveLocale -> "" (no locale anywhere)');
|
|
1015
1130
|
return "";
|
|
1016
1131
|
}
|
|
1017
1132
|
function allLocales(req) {
|
|
1018
|
-
if (!req || typeof req !== "object")
|
|
1133
|
+
if (!req || typeof req !== "object") {
|
|
1134
|
+
console.log("[WWW] render/_locale:allLocales -> [] (no req)");
|
|
1019
1135
|
return [];
|
|
1136
|
+
}
|
|
1020
1137
|
const r = req;
|
|
1021
1138
|
const list = r.payload?.config?.localization?.locales;
|
|
1022
|
-
if (!Array.isArray(list) || list.length === 0)
|
|
1139
|
+
if (!Array.isArray(list) || list.length === 0) {
|
|
1140
|
+
console.log("[WWW] render/_locale:allLocales -> [] (no locales declared)");
|
|
1023
1141
|
return [];
|
|
1142
|
+
}
|
|
1024
1143
|
const out = [];
|
|
1025
1144
|
for (const entry of list) {
|
|
1026
1145
|
if (typeof entry === "string" && entry.length > 0) {
|
|
@@ -1031,6 +1150,7 @@ function allLocales(req) {
|
|
|
1031
1150
|
out.push(code);
|
|
1032
1151
|
}
|
|
1033
1152
|
}
|
|
1153
|
+
console.log("[WWW] render/_locale:allLocales ->", JSON.stringify(out));
|
|
1034
1154
|
return out;
|
|
1035
1155
|
}
|
|
1036
1156
|
|
|
@@ -1040,21 +1160,28 @@ function nextCacheImport() {
|
|
|
1040
1160
|
return cachePromise ??= import("next/cache");
|
|
1041
1161
|
}
|
|
1042
1162
|
function shouldSkipRevalidate(context) {
|
|
1043
|
-
|
|
1163
|
+
const skip = Boolean(context?.disableRevalidate);
|
|
1164
|
+
if (skip)
|
|
1165
|
+
console.log("[WWW] render/hooks:_shared:shouldSkipRevalidate -> skip");
|
|
1166
|
+
return skip;
|
|
1044
1167
|
}
|
|
1045
1168
|
async function safeRevalidatePath(payload, path) {
|
|
1169
|
+
console.log("[WWW] render/hooks:_shared:safeRevalidatePath path=", path);
|
|
1046
1170
|
try {
|
|
1047
1171
|
const { revalidatePath } = await nextCacheImport();
|
|
1048
1172
|
revalidatePath(path);
|
|
1049
1173
|
} catch (error) {
|
|
1174
|
+
console.error("[WWW] render/hooks:_shared:safeRevalidatePath failed path=", path, "err=", String(error));
|
|
1050
1175
|
payload.logger.error(`revalidatePath("${path}") failed: ${String(error)}`);
|
|
1051
1176
|
}
|
|
1052
1177
|
}
|
|
1053
1178
|
async function safeRevalidateTag(payload, tag, profile = "max") {
|
|
1179
|
+
console.log("[WWW] render/hooks:_shared:safeRevalidateTag tag=", tag, "profile=", profile);
|
|
1054
1180
|
try {
|
|
1055
1181
|
const { revalidateTag } = await nextCacheImport();
|
|
1056
1182
|
revalidateTag(tag, profile);
|
|
1057
1183
|
} catch (error) {
|
|
1184
|
+
console.error("[WWW] render/hooks:_shared:safeRevalidateTag failed tag=", tag, "err=", String(error));
|
|
1058
1185
|
payload.logger.error(`revalidateTag("${tag}") failed: ${String(error)}`);
|
|
1059
1186
|
}
|
|
1060
1187
|
}
|
|
@@ -1070,6 +1197,7 @@ function createRevalidateCollectionHook(options) {
|
|
|
1070
1197
|
pathMode = "url"
|
|
1071
1198
|
} = options;
|
|
1072
1199
|
const resolvedSitemapTag = sitemapTag === false ? false : sitemapTag ?? `${collectionSlug}-sitemap`;
|
|
1200
|
+
console.log("[WWW] render/hooks:createRevalidateCollectionHook collectionSlug=", collectionSlug, "urlPathPrefix=", urlPathPrefix, "sitemapTag=", resolvedSitemapTag, "pathMode=", pathMode);
|
|
1073
1201
|
const resolveDefaults = (req) => {
|
|
1074
1202
|
const mode = modeOption ?? "always";
|
|
1075
1203
|
const defaultLocale = defaultLocaleOption ?? req?.payload?.config?.localization?.defaultLocale ?? "";
|
|
@@ -1098,6 +1226,7 @@ function createRevalidateCollectionHook(options) {
|
|
|
1098
1226
|
}
|
|
1099
1227
|
};
|
|
1100
1228
|
const fireCollectionTags = async (payload, docId, req) => {
|
|
1229
|
+
console.log("[WWW] render/hooks:fireCollectionTags collectionSlug=", collectionSlug, "docId=", docId);
|
|
1101
1230
|
if (typeof docId === "string" || typeof docId === "number") {
|
|
1102
1231
|
await safeRevalidateTag(payload, `collection_${collectionSlug}_${docId}`);
|
|
1103
1232
|
}
|
|
@@ -1111,6 +1240,7 @@ function createRevalidateCollectionHook(options) {
|
|
|
1111
1240
|
const { payload } = req;
|
|
1112
1241
|
const typed = doc;
|
|
1113
1242
|
const prev = previousDoc;
|
|
1243
|
+
console.log("[WWW] render/hooks:afterChange collectionSlug=", collectionSlug, "id=", typed.id, "slug=", typed.slug, "prevSlug=", prev?.slug);
|
|
1114
1244
|
const isPublished = typed._status === "published";
|
|
1115
1245
|
const wasPublished = prev?._status === "published";
|
|
1116
1246
|
const prevSlugIsString = typeof prev?.slug === "string";
|
|
@@ -1134,6 +1264,7 @@ function createRevalidateCollectionHook(options) {
|
|
|
1134
1264
|
return doc ?? null;
|
|
1135
1265
|
const { payload } = req;
|
|
1136
1266
|
const typed = doc;
|
|
1267
|
+
console.log("[WWW] render/hooks:afterDelete collectionSlug=", collectionSlug, "id=", typed?.id, "slug=", typed?.slug);
|
|
1137
1268
|
if (pathMode !== "tag-only") {
|
|
1138
1269
|
await fanOutPaths(payload, req, typed?.slug, `Revalidating deleted ${collectionSlug} at path:`);
|
|
1139
1270
|
}
|
|
@@ -1142,11 +1273,14 @@ function createRevalidateCollectionHook(options) {
|
|
|
1142
1273
|
};
|
|
1143
1274
|
return { afterChange, afterDelete };
|
|
1144
1275
|
}
|
|
1145
|
-
var createRevalidatePageHooks = (opts = {}) =>
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1276
|
+
var createRevalidatePageHooks = (opts = {}) => {
|
|
1277
|
+
console.log("[WWW] render/hooks:createRevalidatePageHooks (deprecated alias) opts=", JSON.stringify(opts));
|
|
1278
|
+
return createRevalidateCollectionHook({
|
|
1279
|
+
collectionSlug: "pages",
|
|
1280
|
+
urlPathPrefix: "",
|
|
1281
|
+
...opts
|
|
1282
|
+
});
|
|
1283
|
+
};
|
|
1150
1284
|
|
|
1151
1285
|
// src/data/collections/StaticPages/index.ts
|
|
1152
1286
|
var createStaticPagesCollection = (blocks) => {
|
|
@@ -1234,6 +1368,7 @@ function createStaticPageExports({
|
|
|
1234
1368
|
const default_ = async () => {
|
|
1235
1369
|
const { getLocale } = await import("next-intl/server");
|
|
1236
1370
|
const locale = await getLocale();
|
|
1371
|
+
console.log("[WWW] render/pages:createStaticPageExports:default_ kind=", kind, "locale=", locale);
|
|
1237
1372
|
dbgRenderCount++;
|
|
1238
1373
|
{
|
|
1239
1374
|
let reqUrl = "?";
|
|
@@ -1266,6 +1401,7 @@ function createStaticPageExports({
|
|
|
1266
1401
|
});
|
|
1267
1402
|
}
|
|
1268
1403
|
const cfg = await configPromise;
|
|
1404
|
+
console.log("[WWW] render/pages:createStaticPageExports:default_ -> rendering via PagesPage kind=", kind, "locale=", locale);
|
|
1269
1405
|
return /* @__PURE__ */ jsx9(PagesPage, {
|
|
1270
1406
|
doc,
|
|
1271
1407
|
locale,
|
|
@@ -1283,11 +1419,14 @@ init_PageShowcase();
|
|
|
1283
1419
|
import { RichText as RichText2 } from "@payloadcms/richtext-lexical/react";
|
|
1284
1420
|
import { jsx as jsx10, jsxs as jsxs5, Fragment as Fragment6 } from "react/jsx-runtime";
|
|
1285
1421
|
async function PostsPage({ doc, locale, importMap: _importMap }) {
|
|
1286
|
-
if (!doc)
|
|
1422
|
+
if (!doc) {
|
|
1423
|
+
console.log("[WWW] render/pages:PostsPage no doc");
|
|
1287
1424
|
return /* @__PURE__ */ jsx10(Fragment6, {});
|
|
1425
|
+
}
|
|
1288
1426
|
const title = readText(doc.title, locale);
|
|
1289
1427
|
const excerpt = readText(doc.excerpt, locale);
|
|
1290
1428
|
const content = doc.content;
|
|
1429
|
+
console.log("[WWW] render/pages:PostsPage titleLen=", title.length, "excerptLen=", excerpt.length, "hasContent=", Boolean(content), "locale=", locale);
|
|
1291
1430
|
return /* @__PURE__ */ jsxs5("article", {
|
|
1292
1431
|
className: "posts-page prose prose-neutral dark:prose-invert mx-auto max-w-3xl py-10",
|
|
1293
1432
|
children: [
|
|
@@ -1340,11 +1479,14 @@ function readText(value, preferredLocale) {
|
|
|
1340
1479
|
import"server-only";
|
|
1341
1480
|
import { jsx as jsx11, jsxs as jsxs6, Fragment as Fragment7 } from "react/jsx-runtime";
|
|
1342
1481
|
function HeaderPage({ data, locale: _locale }) {
|
|
1343
|
-
if (!data)
|
|
1482
|
+
if (!data) {
|
|
1483
|
+
console.log("[WWW] render/pages:HeaderPage no data");
|
|
1344
1484
|
return /* @__PURE__ */ jsx11(Fragment7, {});
|
|
1485
|
+
}
|
|
1345
1486
|
const nav = data.nav ?? [];
|
|
1346
1487
|
const items = nav.filter((b) => b.blockType === "navItem");
|
|
1347
1488
|
const columns = nav.filter((b) => b.blockType === "navColumn");
|
|
1489
|
+
console.log("[WWW] render/pages:HeaderPage items=", items.length, "columns=", columns.length, "locale=", _locale);
|
|
1348
1490
|
const renderLink = (link, fallbackHref = "#") => {
|
|
1349
1491
|
if (!link)
|
|
1350
1492
|
return /* @__PURE__ */ jsx11("a", {
|
|
@@ -1398,11 +1540,14 @@ function HeaderPage({ data, locale: _locale }) {
|
|
|
1398
1540
|
import"server-only";
|
|
1399
1541
|
import { jsx as jsx12, jsxs as jsxs7, Fragment as Fragment8 } from "react/jsx-runtime";
|
|
1400
1542
|
function FooterPage({ data, locale: _locale }) {
|
|
1401
|
-
if (!data)
|
|
1543
|
+
if (!data) {
|
|
1544
|
+
console.log("[WWW] render/pages:FooterPage no data");
|
|
1402
1545
|
return /* @__PURE__ */ jsx12(Fragment8, {});
|
|
1546
|
+
}
|
|
1403
1547
|
const nav = data.nav ?? [];
|
|
1404
1548
|
const items = nav.filter((b) => b.blockType === "navItem");
|
|
1405
1549
|
const columns = nav.filter((b) => b.blockType === "navColumn");
|
|
1550
|
+
console.log("[WWW] render/pages:FooterPage items=", items.length, "columns=", columns.length, "locale=", _locale);
|
|
1406
1551
|
const renderLink = (link, fallbackHref = "#") => {
|
|
1407
1552
|
if (!link)
|
|
1408
1553
|
return /* @__PURE__ */ jsx12("a", {
|