@justanarthur/payload-www 0.3.3 → 0.3.5

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/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__ */ jsx7("nav", {
151
153
  "aria-label": "Language",
152
154
  className: "locale-switcher",
@@ -211,8 +213,11 @@ var RenderBlocks = ({
211
213
  locale,
212
214
  searchParams
213
215
  }) => {
214
- if (!blocks || !Array.isArray(blocks) || blocks.length === 0)
216
+ if (!blocks || !Array.isArray(blocks) || blocks.length === 0) {
217
+ console.log("[WWW] render/blocks:RenderBlocks no blocks (locale=", locale, ")");
215
218
  return null;
219
+ }
220
+ console.log("[WWW] render/blocks:RenderBlocks rendering count=", blocks.length, "locale=", locale);
216
221
  const rendered = [];
217
222
  for (let i = 0;i < blocks.length; i++) {
218
223
  const block = blocks[i];
@@ -220,9 +225,10 @@ var RenderBlocks = ({
220
225
  const importMapPath = config.admin?.dependencies?.[blockType]?.path ?? generateImportName("block", blockType);
221
226
  const Block = getFromImportMap(importMapPath, importMap);
222
227
  if (!Block) {
223
- console.warn(`No block found for type: ${blockType}, config.admin?.dependencies?.[blockType]: ${config.admin?.dependencies?.[blockType]}`);
228
+ console.warn(`[WWW] render/blocks:RenderBlocks no block for type=${blockType} importMapPath=${importMapPath} (locale=${locale})`);
224
229
  continue;
225
230
  }
231
+ console.log("[WWW] render/blocks:RenderBlocks [", i, "] blockType=", blockType, "importMapPath=", importMapPath);
226
232
  rendered.push(/* @__PURE__ */ jsx(Block, {
227
233
  index: i,
228
234
  ...blockProps,
@@ -239,9 +245,12 @@ var RenderBlocks = ({
239
245
  // src/render/pages/PagesPage.tsx
240
246
  import { jsx as jsx2, Fragment as Fragment2 } from "react/jsx-runtime";
241
247
  async function PagesPage({ doc, ...props }) {
242
- if (!doc)
248
+ if (!doc) {
249
+ console.log("[WWW] render/pages:PagesPage no doc");
243
250
  return /* @__PURE__ */ jsx2(Fragment2, {});
251
+ }
244
252
  const blocks = doc.blocks ?? [];
253
+ console.log("[WWW] render/pages:PagesPage blocks=", blocks.length, "locale=", props.locale);
245
254
  return /* @__PURE__ */ jsx2(Fragment2, {
246
255
  children: /* @__PURE__ */ jsx2(RenderBlocks, {
247
256
  blocks,
@@ -254,11 +263,14 @@ async function PagesPage({ doc, ...props }) {
254
263
  import"server-only";
255
264
  import { jsx as jsx3, jsxs, Fragment as Fragment3 } from "react/jsx-runtime";
256
265
  function HeaderPage({ data, locale: _locale }) {
257
- if (!data)
266
+ if (!data) {
267
+ console.log("[WWW] render/pages:HeaderPage no data");
258
268
  return /* @__PURE__ */ jsx3(Fragment3, {});
269
+ }
259
270
  const nav = data.nav ?? [];
260
271
  const items = nav.filter((b) => b.blockType === "navItem");
261
272
  const columns = nav.filter((b) => b.blockType === "navColumn");
273
+ console.log("[WWW] render/pages:HeaderPage items=", items.length, "columns=", columns.length, "locale=", _locale);
262
274
  const renderLink = (link, fallbackHref = "#") => {
263
275
  if (!link)
264
276
  return /* @__PURE__ */ jsx3("a", {
@@ -312,11 +324,14 @@ function HeaderPage({ data, locale: _locale }) {
312
324
  import"server-only";
313
325
  import { jsx as jsx4, jsxs as jsxs2, Fragment as Fragment4 } from "react/jsx-runtime";
314
326
  function FooterPage({ data, locale: _locale }) {
315
- if (!data)
327
+ if (!data) {
328
+ console.log("[WWW] render/pages:FooterPage no data");
316
329
  return /* @__PURE__ */ jsx4(Fragment4, {});
330
+ }
317
331
  const nav = data.nav ?? [];
318
332
  const items = nav.filter((b) => b.blockType === "navItem");
319
333
  const columns = nav.filter((b) => b.blockType === "navColumn");
334
+ console.log("[WWW] render/pages:FooterPage items=", items.length, "columns=", columns.length, "locale=", _locale);
320
335
  const renderLink = (link, fallbackHref = "#") => {
321
336
  if (!link)
322
337
  return /* @__PURE__ */ jsx4("a", {
@@ -386,13 +401,17 @@ var STATIC_PAGES_SLUG = "staticPages";
386
401
  import { jsx as jsx5 } from "react/jsx-runtime";
387
402
  function renderCollectionModule(collection = [], slug, importMap, props) {
388
403
  const renderPath = collection?.find((c) => c.slug === slug)?.custom?.path;
389
- if (!renderPath)
404
+ if (!renderPath) {
405
+ console.log("[WWW] render/utils:renderCollectionModule no custom.path slug=", slug);
390
406
  return null;
407
+ }
391
408
  const CollectionRenderModule = getFromImportMap(renderPath, importMap);
392
409
  if (!CollectionRenderModule) {
410
+ console.error("[WWW] render/utils:renderCollectionModule not found slug=", slug, "path=", renderPath);
393
411
  if (false) {}
394
412
  return null;
395
413
  }
414
+ console.log("[WWW] render/utils:renderCollectionModule rendering slug=", slug, "path=", renderPath);
396
415
  return /* @__PURE__ */ jsx5(CollectionRenderModule, {
397
416
  importMap,
398
417
  ...props
@@ -413,6 +432,7 @@ async function buildHreflangAlternates({
413
432
  localePrefix = "always"
414
433
  }) {
415
434
  const allLocaleSlugs = await queryAllLocaleSlugs(storedSlug, locale);
435
+ console.log("[WWW] render/metadata:buildHreflangAlternates storedSlug=", storedSlug, "locale=", locale, "allLocaleSlugs=", JSON.stringify(allLocaleSlugs));
416
436
  const languages = {};
417
437
  const urlFor = (l, slug) => {
418
438
  const trimmedPrefix = urlPrefix.replace(/^\/|\/$/g, "");
@@ -430,6 +450,7 @@ async function buildHreflangAlternates({
430
450
  if (allLocaleSlugs?.[defaultLocale]) {
431
451
  languages["x-default"] = urlFor(defaultLocale, allLocaleSlugs[defaultLocale]);
432
452
  }
453
+ console.log("[WWW] render/metadata:buildHreflangAlternates ->", JSON.stringify(languages));
433
454
  return languages;
434
455
  }
435
456
 
@@ -444,6 +465,11 @@ function getImageUrl(doc, siteUrl) {
444
465
  return img.url.startsWith("http") ? img.url : `${siteUrl}${img.url}`;
445
466
  return null;
446
467
  }
468
+ function getImageUrlWithLog(doc, siteUrl) {
469
+ const result = getImageUrl(doc, siteUrl);
470
+ console.log("[WWW] render/metadata:jsonld:getImageUrl ->", result);
471
+ return result;
472
+ }
447
473
  function resolveLocalizedField(value, locale) {
448
474
  if (value == null)
449
475
  return "";
@@ -465,6 +491,13 @@ function resolveLocalizedField(value, locale) {
465
491
  }
466
492
  return Object.values(obj).filter((v) => typeof v === "string" && v.length > 0).join(" / ");
467
493
  }
494
+ function resolveLocalizedFieldWithLog(value, locale) {
495
+ const result = resolveLocalizedField(value, locale);
496
+ if (value && typeof value === "object") {
497
+ console.log("[WWW] render/metadata:jsonld:resolveLocalizedField locale=", locale, "->", JSON.stringify(result));
498
+ }
499
+ return result;
500
+ }
468
501
  function buildArticleLd({
469
502
  doc,
470
503
  url,
@@ -475,12 +508,13 @@ function buildArticleLd({
475
508
  publisherLogo
476
509
  }) {
477
510
  const name = publisherName ?? new URL(siteUrl).hostname;
511
+ console.log("[WWW] render/metadata:buildArticleLd url=", url, "locale=", locale, "type=", type, "publisherName=", name);
478
512
  const ld = {
479
513
  "@context": "https://schema.org",
480
514
  "@type": type,
481
515
  "@id": `${url}#article`,
482
- headline: resolveLocalizedField(doc.title, locale),
483
- description: resolveLocalizedField(doc.meta?.description ?? doc.description ?? doc.excerpt, locale),
516
+ headline: resolveLocalizedFieldWithLog(doc.title, locale),
517
+ description: resolveLocalizedFieldWithLog(doc.meta?.description ?? doc.description ?? doc.excerpt, locale),
484
518
  inLanguage: locale,
485
519
  url,
486
520
  dateModified: doc.updatedAt ? new Date(doc.updatedAt).toISOString() : undefined
@@ -488,7 +522,7 @@ function buildArticleLd({
488
522
  const datePublished = doc.publishedAt ?? doc.createdAt;
489
523
  if (datePublished)
490
524
  ld.datePublished = new Date(datePublished).toISOString();
491
- const imgUrl = getImageUrl(doc, siteUrl);
525
+ const imgUrl = getImageUrlWithLog(doc, siteUrl);
492
526
  if (imgUrl)
493
527
  ld.image = imgUrl;
494
528
  ld.author = { "@type": "Organization", name, url: siteUrl };
@@ -504,6 +538,7 @@ function buildBreadcrumbsLd({
504
538
  items,
505
539
  currentUrl
506
540
  }) {
541
+ console.log("[WWW] render/metadata:buildBreadcrumbsLd items=", items.length, "currentUrl=", currentUrl);
507
542
  return {
508
543
  "@context": "https://schema.org",
509
544
  "@type": "BreadcrumbList",
@@ -521,6 +556,7 @@ function buildOrganizationLd({
521
556
  logo,
522
557
  sameAs
523
558
  }) {
559
+ console.log("[WWW] render/metadata:buildOrganizationLd siteUrl=", siteUrl, "name=", name, "logo?", Boolean(logo), "sameAs?", Boolean(sameAs));
524
560
  const org = {
525
561
  "@context": "https://schema.org",
526
562
  "@type": "Organization",
@@ -536,23 +572,29 @@ function buildOrganizationLd({
536
572
  // src/render/metadata/slug.ts
537
573
  var SLUG_NESTED_DIVIDER = "_";
538
574
  function segmentsToStoredSlug(segments, nested) {
539
- if (!Array.isArray(segments))
575
+ if (!Array.isArray(segments)) {
576
+ console.log("[WWW] render/metadata:segmentsToStoredSlug string passthrough:", JSON.stringify(segments));
540
577
  return segments;
541
- if (nested)
542
- return segments.join(SLUG_NESTED_DIVIDER);
543
- return segments[0] ?? "";
578
+ }
579
+ const result = nested ? segments.join(SLUG_NESTED_DIVIDER) : segments[0] ?? "";
580
+ console.log("[WWW] render/metadata:segmentsToStoredSlug nested=", nested, "segments=", JSON.stringify(segments), "->", result);
581
+ return result;
544
582
  }
545
583
  function segmentsToUrlPath(segments, nested) {
584
+ let result;
546
585
  if (!Array.isArray(segments))
547
- return "/" + segments;
548
- if (nested)
549
- return "/" + segments.join("/");
550
- return "/" + (segments[0] ?? "");
586
+ result = "/" + segments;
587
+ else if (nested)
588
+ result = "/" + segments.join("/");
589
+ else
590
+ result = "/" + (segments[0] ?? "");
591
+ console.log("[WWW] render/metadata:segmentsToUrlPath nested=", nested, "segments=", JSON.stringify(segments), "->", result);
592
+ return result;
551
593
  }
552
594
  function storedSlugToSegments(storedSlug, nested) {
553
- if (nested)
554
- return storedSlug.split(SLUG_NESTED_DIVIDER);
555
- return storedSlug;
595
+ const result = nested ? storedSlug.split(SLUG_NESTED_DIVIDER) : storedSlug;
596
+ console.log("[WWW] render/metadata:storedSlugToSegments nested=", nested, "storedSlug=", storedSlug, "->", JSON.stringify(result));
597
+ return result;
556
598
  }
557
599
  function buildCanonicalUrl({
558
600
  siteUrl,
@@ -562,7 +604,9 @@ function buildCanonicalUrl({
562
604
  }) {
563
605
  const trimmedPrefix = urlPrefix.replace(/^\/|\/$/g, "");
564
606
  const prefixSegment = trimmedPrefix ? `/${trimmedPrefix}` : "";
565
- return `${siteUrl}/${locale}${prefixSegment}${urlPath}`;
607
+ const result = `${siteUrl}/${locale}${prefixSegment}${urlPath}`;
608
+ console.log("[WWW] render/metadata:buildCanonicalUrl siteUrl=", siteUrl, "locale=", locale, "urlPrefix=", urlPrefix, "urlPath=", urlPath, "->", result);
609
+ return result;
566
610
  }
567
611
  function getUrlPath(segments, nested, homeSlug) {
568
612
  const urlPath = segmentsToUrlPath(segments, nested);
@@ -588,6 +632,7 @@ var queryDocBySlug = cache(async function queryDocBySlug2({
588
632
  draft = false,
589
633
  config
590
634
  }) {
635
+ console.log("[WWW] render/metadata:queryDocBySlug collection=", collectionSlug, "slug=", slug, "slugField=", slugField, "locale=", locale, "draft=", draft);
591
636
  const payload = await getPayload({ config });
592
637
  const result = await payload.find({
593
638
  collection: collectionSlug,
@@ -598,7 +643,9 @@ var queryDocBySlug = cache(async function queryDocBySlug2({
598
643
  where: { [slugField]: { equals: slug } },
599
644
  locale
600
645
  });
601
- return result.docs?.[0] ?? null;
646
+ const doc = result.docs?.[0] ?? null;
647
+ console.log("[WWW] render/metadata:queryDocBySlug ->", doc ? "hit" : "miss");
648
+ return doc;
602
649
  });
603
650
  var queryAllDocs = cache(async function queryAllDocs2({
604
651
  collectionSlug,
@@ -606,6 +653,7 @@ var queryAllDocs = cache(async function queryAllDocs2({
606
653
  locale,
607
654
  config
608
655
  }) {
656
+ console.log("[WWW] render/metadata:queryAllDocs collection=", collectionSlug, "locale=", locale);
609
657
  const payload = await getPayload({ config });
610
658
  const result = await payload.find({
611
659
  collection: collectionSlug,
@@ -616,7 +664,9 @@ var queryAllDocs = cache(async function queryAllDocs2({
616
664
  select: { [slugField]: true },
617
665
  locale
618
666
  });
619
- return result.docs ?? [];
667
+ const docs = result.docs ?? [];
668
+ console.log("[WWW] render/metadata:queryAllDocs -> count=", docs.length);
669
+ return docs;
620
670
  });
621
671
  var queryAllLocaleSlugs = cache(async function queryAllLocaleSlugs2({
622
672
  collectionSlug,
@@ -625,6 +675,7 @@ var queryAllLocaleSlugs = cache(async function queryAllLocaleSlugs2({
625
675
  locale,
626
676
  config
627
677
  }) {
678
+ console.log("[WWW] render/metadata:queryAllLocaleSlugs collection=", collectionSlug, "slug=", slug, "locale=", locale);
628
679
  const payload = await getPayload({ config });
629
680
  const result = await payload.find({
630
681
  collection: collectionSlug,
@@ -637,8 +688,10 @@ var queryAllLocaleSlugs = cache(async function queryAllLocaleSlugs2({
637
688
  select: { [slugField]: true }
638
689
  });
639
690
  const doc = result.docs?.[0];
640
- if (!doc)
691
+ if (!doc) {
692
+ console.log("[WWW] render/metadata:queryAllLocaleSlugs -> undefined (no doc)");
641
693
  return;
694
+ }
642
695
  let fieldValue = doc[slugField];
643
696
  if (doc.id != null) {
644
697
  const allLocales = await payload.findByID({
@@ -653,6 +706,7 @@ var queryAllLocaleSlugs = cache(async function queryAllLocaleSlugs2({
653
706
  fieldValue = allLocales[slugField];
654
707
  }
655
708
  if (fieldValue && typeof fieldValue === "object") {
709
+ console.log("[WWW] render/metadata:queryAllLocaleSlugs -> localized map=", JSON.stringify(fieldValue));
656
710
  return fieldValue;
657
711
  }
658
712
  const resolved = await config;
@@ -660,6 +714,7 @@ var queryAllLocaleSlugs = cache(async function queryAllLocaleSlugs2({
660
714
  const out = {};
661
715
  for (const l of rawLocales)
662
716
  out[l] = String(fieldValue ?? slug);
717
+ console.log("[WWW] render/metadata:queryAllLocaleSlugs -> flat-fanout locales=", rawLocales.length, "slug=", JSON.stringify(fieldValue ?? slug));
663
718
  return out;
664
719
  });
665
720
  var queryGlobal = cache(async function queryGlobal2({
@@ -669,6 +724,7 @@ var queryGlobal = cache(async function queryGlobal2({
669
724
  draft = false,
670
725
  config
671
726
  }) {
727
+ console.log("[WWW] render/metadata:queryGlobal global=", globalSlug, "locale=", locale, "depth=", depth, "draft=", draft);
672
728
  const payload = await getPayload({ config });
673
729
  try {
674
730
  const global = await payload.findGlobal({
@@ -677,17 +733,23 @@ var queryGlobal = cache(async function queryGlobal2({
677
733
  draft,
678
734
  locale
679
735
  });
736
+ console.log("[WWW] render/metadata:queryGlobal -> hit");
680
737
  return global;
681
- } catch {
738
+ } catch (error) {
739
+ console.warn("[WWW] render/metadata:queryGlobal failed for slug=", globalSlug, "err=", String(error));
682
740
  return null;
683
741
  }
684
742
  });
685
743
  function getRenderModuleExports(exportName, collection, importMap) {
686
744
  const path = collection?.custom?.path;
687
- if (!path)
745
+ if (!path) {
746
+ console.log("[WWW] render/metadata:getRenderModuleExports no custom.path exportName=", exportName);
688
747
  return;
748
+ }
689
749
  const mod = getFromImportMap(path, importMap);
690
- return mod?.[exportName];
750
+ const value = mod?.[exportName];
751
+ console.log("[WWW] render/metadata:getRenderModuleExports exportName=", exportName, "path=", path, "hit=", Boolean(value));
752
+ return value;
691
753
  }
692
754
 
693
755
  // src/render/pages/createCollectionPageExports.tsx
@@ -720,11 +782,15 @@ function createCollectionPageExports({
720
782
  const localePrefixMode = typeof routing.localePrefix === "string" ? routing.localePrefix : routing.localePrefix?.mode ?? "always";
721
783
  const buildLocalePath = (locale, storedSlug) => {
722
784
  const urlPath = getUrlPath(storedSlugToSegments(storedSlug, nested), nested, HOME_SLUG);
785
+ let result;
723
786
  if (localePrefixMode === "never")
724
- return urlPath;
725
- if (localePrefixMode === "as-needed" && locale === defaultLocale)
726
- return urlPath;
727
- return `/${locale}${urlPath}`;
787
+ result = urlPath;
788
+ else if (localePrefixMode === "as-needed" && locale === defaultLocale)
789
+ result = urlPath;
790
+ else
791
+ result = `/${locale}${urlPath}`;
792
+ console.log("[WWW] render/pages:createCollectionPageExports:buildLocalePath locale=", locale, "storedSlug=", storedSlug, "->", result);
793
+ return result;
728
794
  };
729
795
  async function fetchDoc(locale, storedSlug, draft = false) {
730
796
  return queryDocBySlug({
@@ -755,14 +821,16 @@ function createCollectionPageExports({
755
821
  for (const [key, url] of Object.entries(languages)) {
756
822
  alternates[key] = url;
757
823
  }
824
+ console.log("[WWW] render/pages:createCollectionPageExports:resolveHreflangAlternates canonical=", canonical, "alts=", JSON.stringify(alternates));
758
825
  return { alternates, canonical };
759
826
  }
760
827
  const default_ = async (props) => {
761
828
  const { slug: rawSlugSegments, locale: incomingLocale } = await props.params ?? {};
762
829
  const slugSegments = Array.isArray(rawSlugSegments) ? rawSlugSegments : [];
763
830
  const locale = typeof incomingLocale === "string" ? incomingLocale : defaultLocale;
831
+ console.log("[WWW] render/pages:createCollectionPageExports:default_ collectionSlug=", slug, "locale=", locale, "segments=", JSON.stringify(slugSegments), "showcase=", showcaseEnabled);
764
832
  if (!locales.includes(locale)) {
765
- console.error(`[WWW-DBG ${slug} notFound: invalid-locale] locale=${locale} segments=${JSON.stringify(slugSegments)}`);
833
+ console.error(`[WWW] render/pages:createCollectionPageExports:default_ notFound invalid-locale collection=${slug} locale=${locale} segments=${JSON.stringify(slugSegments)}`);
766
834
  const { notFound } = await import("next/navigation");
767
835
  notFound();
768
836
  }
@@ -770,16 +838,18 @@ function createCollectionPageExports({
770
838
  setRequestLocale(locale);
771
839
  const { draftMode } = await import("next/headers");
772
840
  const { isEnabled: draft } = await draftMode();
841
+ console.log("[WWW] render/pages:createCollectionPageExports:default_ draftMode=", draft);
773
842
  const storedSlug = segmentsToStoredSlug(slugSegments, nested);
774
843
  const doc = await fetchDoc(locale, storedSlug, draft);
775
844
  if (!doc) {
776
- console.error(`[WWW-DBG ${slug} notFound: no-doc] locale=${locale} storedSlug="${storedSlug}" segments=${JSON.stringify(slugSegments)} draft=${draft}`);
845
+ console.error(`[WWW] render/pages:createCollectionPageExports:default_ notFound no-doc collection=${slug} locale=${locale} storedSlug="${storedSlug}" segments=${JSON.stringify(slugSegments)} draft=${draft}`);
777
846
  const { notFound } = await import("next/navigation");
778
847
  notFound();
779
848
  }
780
849
  const cfg = await configPromise;
781
850
  const collectionCustomPath = cfg.collections.find((c) => c.slug === slug)?.custom?.path;
782
851
  const effectivePath = renderPath ?? collectionCustomPath ?? defaultRenderPath;
852
+ console.log("[WWW] render/pages:createCollectionPageExports:default_ effectivePath=", effectivePath);
783
853
  const render = effectivePath === PAGES_RENDER_PATH ? /* @__PURE__ */ jsx8(PagesPage, {
784
854
  doc,
785
855
  importMap,
@@ -841,15 +911,22 @@ function createCollectionPageExports({
841
911
  const { slug: rawSlugSegments, locale: incomingLocale } = await props.params ?? {};
842
912
  const slugSegments = Array.isArray(rawSlugSegments) ? rawSlugSegments : [];
843
913
  const locale = typeof incomingLocale === "string" ? incomingLocale : defaultLocale;
844
- if (!locales.includes(locale))
914
+ console.log("[WWW] render/pages:createCollectionPageExports:generateMetadata collectionSlug=", slug, "locale=", locale, "segments=", JSON.stringify(slugSegments));
915
+ if (!locales.includes(locale)) {
916
+ console.log("[WWW] render/pages:createCollectionPageExports:generateMetadata invalid locale -> not found meta");
845
917
  return { title: "Not found", robots: { index: false, follow: false } };
918
+ }
846
919
  const storedSlug = segmentsToStoredSlug(slugSegments, nested);
847
920
  const doc = await fetchDoc(locale, storedSlug);
848
- if (!doc)
921
+ if (!doc) {
922
+ console.log("[WWW] render/pages:createCollectionPageExports:generateMetadata no doc -> not found meta");
849
923
  return { title: "Not found", robots: { index: false, follow: false } };
924
+ }
850
925
  const collection = cfg.collections.find((c) => c.slug === slug);
851
- if (!collection)
926
+ if (!collection) {
927
+ console.warn("[WWW] render/pages:createCollectionPageExports:generateMetadata collection not in config slug=", slug);
852
928
  return {};
929
+ }
853
930
  const { canonical, alternates } = await resolveHreflangAlternates(locale, storedSlug);
854
931
  const meta = await generateMeta({
855
932
  doc,
@@ -871,6 +948,7 @@ function createCollectionPageExports({
871
948
  const urlPath = buildLocalePath(locale, storedSlug);
872
949
  const canonical = `${siteUrl}${urlPath}`;
873
950
  const entries = Array.isArray(jsonLdOption) ? jsonLdOption : metadataType === "article" ? [{ type: "article" }] : [{ type: "website" }];
951
+ console.log("[WWW] render/pages:createCollectionPageExports:generateJsonLd collection=", slug, "locale=", locale, "entries=", entries.map((e) => e.type).join(","));
874
952
  const outputs = [];
875
953
  for (const entry of entries) {
876
954
  const id = entry.id ?? `jsonld-${entry.type}-${outputs.length}`;
@@ -931,6 +1009,7 @@ function createCollectionPageExports({
931
1009
  return outputs;
932
1010
  }
933
1011
  async function generateStaticParams() {
1012
+ console.log("[WWW] render/pages:createCollectionPageExports:generateStaticParams collection=", slug, "locales=", JSON.stringify(locales));
934
1013
  const params = [];
935
1014
  for (const locale of locales) {
936
1015
  const docs = await queryAllDocs({ collectionSlug: slug, slugField: "slug", locale, config: configPromise });
@@ -942,9 +1021,11 @@ function createCollectionPageExports({
942
1021
  params.push({ slug: Array.isArray(segments) ? segments : [segments], locale });
943
1022
  }
944
1023
  }
1024
+ console.log("[WWW] render/pages:createCollectionPageExports:generateStaticParams -> count=", params.length);
945
1025
  return params;
946
1026
  }
947
1027
  async function generateSitemap() {
1028
+ console.log("[WWW] render/pages:createCollectionPageExports:generateSitemap collection=", slug, "locales=", JSON.stringify(locales));
948
1029
  const docs = await queryAllDocs({
949
1030
  collectionSlug: slug,
950
1031
  slugField: "slug",
@@ -964,6 +1045,7 @@ function createCollectionPageExports({
964
1045
  urls.push({ url: `${siteUrl}${urlPath}`, lastModified: lastmod, changeFrequency: changefreq, priority });
965
1046
  }
966
1047
  }
1048
+ console.log("[WWW] render/pages:createCollectionPageExports:generateSitemap -> urls=", urls.length);
967
1049
  return urls;
968
1050
  }
969
1051
  return {
@@ -24,6 +24,7 @@ import { jsx } from "react/jsx-runtime";
24
24
  var LivePreviewListener = ({ serverURL }) => {
25
25
  const router = useRouter();
26
26
  const url = serverURL ?? process.env.NEXT_PUBLIC_SERVER_URL ?? (typeof window !== "undefined" ? window.location.origin : "");
27
+ console.log("[WWW] render/components:LivePreviewListener serverURL=", url);
27
28
  return /* @__PURE__ */ jsx(PayloadLivePreview, {
28
29
  refresh: router.refresh,
29
30
  serverURL: url
@@ -44,13 +45,19 @@ var AdminBar = ({ preview, exitPreviewPath = "/next/exit-preview", labels }) =>
44
45
  const router = useRouter2();
45
46
  const [open, setOpen] = useState(false);
46
47
  const merged = { ...defaultLabels, ...labels };
47
- if (!preview)
48
+ if (!preview) {
49
+ console.log("[WWW] render/components:AdminBar preview=false -> null");
48
50
  return null;
51
+ }
52
+ console.log("[WWW] render/components:AdminBar preview=true exitPreviewPath=", exitPreviewPath);
49
53
  return /* @__PURE__ */ jsxs(Fragment, {
50
54
  children: [
51
55
  /* @__PURE__ */ jsx2("button", {
52
56
  type: "button",
53
- onClick: () => setOpen(true),
57
+ onClick: () => {
58
+ console.log("[WWW] render/components:AdminBar trigger clicked");
59
+ setOpen(true);
60
+ },
54
61
  title: merged.triggerHint,
55
62
  style: {
56
63
  position: "fixed",
@@ -115,7 +122,10 @@ var AdminBar = ({ preview, exitPreviewPath = "/next/exit-preview", labels }) =>
115
122
  }),
116
123
  /* @__PURE__ */ jsx2("a", {
117
124
  href: exitPreviewPath,
118
- onClick: () => router.refresh(),
125
+ onClick: () => {
126
+ console.log("[WWW] render/components:AdminBar exit preview -> refresh");
127
+ router.refresh();
128
+ },
119
129
  style: {
120
130
  display: "inline-block",
121
131
  padding: "6px 10px",