@gaddario98/react-core 2.1.4 → 2.1.6
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 +630 -4
- package/dist/pages/index.d.ts +527 -682
- package/dist/pages/index.js +242 -258
- package/dist/pages/index.js.map +1 -1
- package/dist/pages/index.mjs +242 -258
- package/dist/pages/index.mjs.map +1 -1
- package/dist/queries/index.d.ts +25 -4
- package/dist/queries/index.js +211 -216
- package/dist/queries/index.js.map +1 -1
- package/dist/queries/index.mjs +211 -216
- package/dist/queries/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/pages/index.mjs
CHANGED
|
@@ -313,7 +313,7 @@ const PageContentItemInner = ({
|
|
|
313
313
|
pageId
|
|
314
314
|
});
|
|
315
315
|
const isHidden = useMemo(() => {
|
|
316
|
-
if (typeof item.hidden ===
|
|
316
|
+
if (typeof item.hidden === "function") {
|
|
317
317
|
return item.hidden({
|
|
318
318
|
get,
|
|
319
319
|
set
|
|
@@ -326,12 +326,12 @@ const PageContentItemInner = ({
|
|
|
326
326
|
content: item,
|
|
327
327
|
ns: ns,
|
|
328
328
|
pageId: pageId
|
|
329
|
-
}, (_a = item.key) !== null && _a !== void 0 ? _a :
|
|
329
|
+
}, (_a = item.key) !== null && _a !== void 0 ? _a : "");
|
|
330
330
|
};
|
|
331
331
|
const PageContentItem = memo(PageContentItemInner);
|
|
332
332
|
const useGenerateContentRender = ({
|
|
333
333
|
pageId,
|
|
334
|
-
ns =
|
|
334
|
+
ns = "",
|
|
335
335
|
contents = [],
|
|
336
336
|
formData
|
|
337
337
|
}) => {
|
|
@@ -342,7 +342,7 @@ const useGenerateContentRender = ({
|
|
|
342
342
|
pageId
|
|
343
343
|
});
|
|
344
344
|
const contentsWithQueriesDeps = useMemo(() => {
|
|
345
|
-
if (typeof contents ===
|
|
345
|
+
if (typeof contents === "function") {
|
|
346
346
|
return contents({
|
|
347
347
|
get,
|
|
348
348
|
set
|
|
@@ -374,7 +374,10 @@ const useGenerateContentRender = ({
|
|
|
374
374
|
};
|
|
375
375
|
}), [contentsWithQueriesDeps, ns, pageId]);
|
|
376
376
|
// Merge and sort - only when either array changes
|
|
377
|
-
const memorizedContents = useMemo(() =>
|
|
377
|
+
const memorizedContents = useMemo(() => {
|
|
378
|
+
var _a_0, _b;
|
|
379
|
+
return (_b = (_a_0 = [...dynamicElements, ...formElementsWithKey].sort((a, b) => a.index - b.index || String(a.key).localeCompare(String(b.key)))) === null || _a_0 === void 0 ? void 0 : _a_0.filter(item => item.element !== null)) !== null && _b !== void 0 ? _b : [];
|
|
380
|
+
}, [dynamicElements, formElementsWithKey]);
|
|
378
381
|
return {
|
|
379
382
|
components: memorizedContents,
|
|
380
383
|
allContents: [...contentsWithQueriesDeps, ...formData.formContents]
|
|
@@ -494,7 +497,7 @@ function _temp6(item_1) {
|
|
|
494
497
|
* @module config/metadata
|
|
495
498
|
*/
|
|
496
499
|
// ─── Platform detection ──────────────────────────────────────
|
|
497
|
-
const isWeb = typeof document !==
|
|
500
|
+
const isWeb = typeof document !== "undefined";
|
|
498
501
|
// ─── Request-scoped Metadata Store ───────────────────────────
|
|
499
502
|
/**
|
|
500
503
|
* Create a new request-scoped metadata store.
|
|
@@ -520,18 +523,18 @@ const globalStore = createMetadataStore();
|
|
|
520
523
|
function updateOrCreateMeta(selector, content, attributes = {}) {
|
|
521
524
|
let element = document.querySelector(selector);
|
|
522
525
|
if (!element) {
|
|
523
|
-
element = document.createElement(
|
|
526
|
+
element = document.createElement("meta");
|
|
524
527
|
Object.entries(attributes).forEach(([key, value]) => {
|
|
525
528
|
element === null || element === void 0 ? void 0 : element.setAttribute(key, value);
|
|
526
529
|
});
|
|
527
530
|
document.head.appendChild(element);
|
|
528
531
|
}
|
|
529
|
-
element.setAttribute(
|
|
532
|
+
element.setAttribute("content", content);
|
|
530
533
|
}
|
|
531
534
|
function updateOrCreateLink(selector, attributes) {
|
|
532
535
|
let element = document.querySelector(selector);
|
|
533
536
|
if (!element) {
|
|
534
|
-
element = document.createElement(
|
|
537
|
+
element = document.createElement("link");
|
|
535
538
|
document.head.appendChild(element);
|
|
536
539
|
}
|
|
537
540
|
Object.entries(attributes).forEach(([key, value]) => {
|
|
@@ -556,33 +559,33 @@ function applyMetadataToDom(resolved) {
|
|
|
556
559
|
// ── Standard meta tags ──────────────────────────────────────
|
|
557
560
|
if (resolved.description) {
|
|
558
561
|
updateOrCreateMeta('meta[name="description"]', resolved.description, {
|
|
559
|
-
name:
|
|
562
|
+
name: "description"
|
|
560
563
|
});
|
|
561
564
|
}
|
|
562
565
|
if ((_a = resolved.keywords) === null || _a === void 0 ? void 0 : _a.length) {
|
|
563
|
-
updateOrCreateMeta('meta[name="keywords"]', resolved.keywords.join(
|
|
564
|
-
name:
|
|
566
|
+
updateOrCreateMeta('meta[name="keywords"]', resolved.keywords.join(", "), {
|
|
567
|
+
name: "keywords"
|
|
565
568
|
});
|
|
566
569
|
}
|
|
567
570
|
if (resolved.author) {
|
|
568
571
|
updateOrCreateMeta('meta[name="author"]', resolved.author, {
|
|
569
|
-
name:
|
|
572
|
+
name: "author"
|
|
570
573
|
});
|
|
571
574
|
}
|
|
572
575
|
if (resolved.viewport) {
|
|
573
576
|
updateOrCreateMeta('meta[name="viewport"]', resolved.viewport, {
|
|
574
|
-
name:
|
|
577
|
+
name: "viewport"
|
|
575
578
|
});
|
|
576
579
|
}
|
|
577
580
|
if (resolved.themeColor) {
|
|
578
581
|
updateOrCreateMeta('meta[name="theme-color"]', resolved.themeColor, {
|
|
579
|
-
name:
|
|
582
|
+
name: "theme-color"
|
|
580
583
|
});
|
|
581
584
|
}
|
|
582
585
|
// ── Canonical ───────────────────────────────────────────────
|
|
583
586
|
if (resolved.canonical) {
|
|
584
587
|
updateOrCreateLink('link[rel="canonical"]', {
|
|
585
|
-
rel:
|
|
588
|
+
rel: "canonical",
|
|
586
589
|
href: resolved.canonical
|
|
587
590
|
});
|
|
588
591
|
}
|
|
@@ -595,39 +598,39 @@ function applyMetadataToDom(resolved) {
|
|
|
595
598
|
const og = resolved.openGraph;
|
|
596
599
|
if (og.title) {
|
|
597
600
|
updateOrCreateMeta('meta[property="og:title"]', og.title, {
|
|
598
|
-
property:
|
|
601
|
+
property: "og:title"
|
|
599
602
|
});
|
|
600
603
|
}
|
|
601
604
|
if (og.description) {
|
|
602
605
|
updateOrCreateMeta('meta[property="og:description"]', og.description, {
|
|
603
|
-
property:
|
|
606
|
+
property: "og:description"
|
|
604
607
|
});
|
|
605
608
|
}
|
|
606
609
|
if (og.type) {
|
|
607
610
|
updateOrCreateMeta('meta[property="og:type"]', og.type, {
|
|
608
|
-
property:
|
|
611
|
+
property: "og:type"
|
|
609
612
|
});
|
|
610
613
|
}
|
|
611
614
|
if (og.url) {
|
|
612
615
|
updateOrCreateMeta('meta[property="og:url"]', og.url, {
|
|
613
|
-
property:
|
|
616
|
+
property: "og:url"
|
|
614
617
|
});
|
|
615
618
|
}
|
|
616
619
|
if (og.siteName) {
|
|
617
620
|
updateOrCreateMeta('meta[property="og:site_name"]', og.siteName, {
|
|
618
|
-
property:
|
|
621
|
+
property: "og:site_name"
|
|
619
622
|
});
|
|
620
623
|
}
|
|
621
624
|
if (og.locale) {
|
|
622
625
|
updateOrCreateMeta('meta[property="og:locale"]', og.locale, {
|
|
623
|
-
property:
|
|
626
|
+
property: "og:locale"
|
|
624
627
|
});
|
|
625
628
|
}
|
|
626
629
|
// OG images (advanced: multiple + alt/width/height)
|
|
627
630
|
if ((_b = og.images) === null || _b === void 0 ? void 0 : _b.length) {
|
|
628
631
|
applyOgImages(og.images);
|
|
629
632
|
} else if (og.image) {
|
|
630
|
-
const img = typeof og.image ===
|
|
633
|
+
const img = typeof og.image === "string" ? {
|
|
631
634
|
url: og.image
|
|
632
635
|
} : og.image;
|
|
633
636
|
applyOgImages([img]);
|
|
@@ -637,35 +640,35 @@ function applyMetadataToDom(resolved) {
|
|
|
637
640
|
const art = og.article;
|
|
638
641
|
if (art.publishedTime) {
|
|
639
642
|
updateOrCreateMeta('meta[property="article:published_time"]', art.publishedTime, {
|
|
640
|
-
property:
|
|
643
|
+
property: "article:published_time"
|
|
641
644
|
});
|
|
642
645
|
}
|
|
643
646
|
if (art.modifiedTime) {
|
|
644
647
|
updateOrCreateMeta('meta[property="article:modified_time"]', art.modifiedTime, {
|
|
645
|
-
property:
|
|
648
|
+
property: "article:modified_time"
|
|
646
649
|
});
|
|
647
650
|
}
|
|
648
651
|
if (art.expirationTime) {
|
|
649
652
|
updateOrCreateMeta('meta[property="article:expiration_time"]', art.expirationTime, {
|
|
650
|
-
property:
|
|
653
|
+
property: "article:expiration_time"
|
|
651
654
|
});
|
|
652
655
|
}
|
|
653
656
|
if (art.section) {
|
|
654
657
|
updateOrCreateMeta('meta[property="article:section"]', art.section, {
|
|
655
|
-
property:
|
|
658
|
+
property: "article:section"
|
|
656
659
|
});
|
|
657
660
|
}
|
|
658
661
|
const authors = Array.isArray(art.author) ? art.author : art.author ? [art.author] : [];
|
|
659
662
|
authors.forEach((author, i) => {
|
|
660
663
|
updateOrCreateMeta(`meta[property="article:author"][data-index="${i}"]`, author, {
|
|
661
|
-
property:
|
|
662
|
-
|
|
664
|
+
property: "article:author",
|
|
665
|
+
"data-index": String(i)
|
|
663
666
|
});
|
|
664
667
|
});
|
|
665
668
|
(_c = art.tags) === null || _c === void 0 ? void 0 : _c.forEach((tag, i) => {
|
|
666
669
|
updateOrCreateMeta(`meta[property="article:tag"][data-index="${i}"]`, tag, {
|
|
667
|
-
property:
|
|
668
|
-
|
|
670
|
+
property: "article:tag",
|
|
671
|
+
"data-index": String(i)
|
|
669
672
|
});
|
|
670
673
|
});
|
|
671
674
|
}
|
|
@@ -675,37 +678,37 @@ function applyMetadataToDom(resolved) {
|
|
|
675
678
|
const tw = resolved.twitter;
|
|
676
679
|
if (tw.card) {
|
|
677
680
|
updateOrCreateMeta('meta[name="twitter:card"]', tw.card, {
|
|
678
|
-
name:
|
|
681
|
+
name: "twitter:card"
|
|
679
682
|
});
|
|
680
683
|
}
|
|
681
684
|
if (tw.site) {
|
|
682
685
|
updateOrCreateMeta('meta[name="twitter:site"]', tw.site, {
|
|
683
|
-
name:
|
|
686
|
+
name: "twitter:site"
|
|
684
687
|
});
|
|
685
688
|
}
|
|
686
689
|
if (tw.creator) {
|
|
687
690
|
updateOrCreateMeta('meta[name="twitter:creator"]', tw.creator, {
|
|
688
|
-
name:
|
|
691
|
+
name: "twitter:creator"
|
|
689
692
|
});
|
|
690
693
|
}
|
|
691
694
|
if (tw.title) {
|
|
692
695
|
updateOrCreateMeta('meta[name="twitter:title"]', tw.title, {
|
|
693
|
-
name:
|
|
696
|
+
name: "twitter:title"
|
|
694
697
|
});
|
|
695
698
|
}
|
|
696
699
|
if (tw.description) {
|
|
697
700
|
updateOrCreateMeta('meta[name="twitter:description"]', tw.description, {
|
|
698
|
-
name:
|
|
701
|
+
name: "twitter:description"
|
|
699
702
|
});
|
|
700
703
|
}
|
|
701
704
|
if (tw.image) {
|
|
702
705
|
updateOrCreateMeta('meta[name="twitter:image"]', tw.image, {
|
|
703
|
-
name:
|
|
706
|
+
name: "twitter:image"
|
|
704
707
|
});
|
|
705
708
|
}
|
|
706
709
|
if (tw.imageAlt) {
|
|
707
710
|
updateOrCreateMeta('meta[name="twitter:image:alt"]', tw.imageAlt, {
|
|
708
|
-
name:
|
|
711
|
+
name: "twitter:image:alt"
|
|
709
712
|
});
|
|
710
713
|
}
|
|
711
714
|
}
|
|
@@ -714,7 +717,7 @@ function applyMetadataToDom(resolved) {
|
|
|
714
717
|
const alt = resolved.alternates;
|
|
715
718
|
if (alt.canonical) {
|
|
716
719
|
updateOrCreateLink('link[rel="canonical"]', {
|
|
717
|
-
rel:
|
|
720
|
+
rel: "canonical",
|
|
718
721
|
href: alt.canonical
|
|
719
722
|
});
|
|
720
723
|
}
|
|
@@ -722,8 +725,8 @@ function applyMetadataToDom(resolved) {
|
|
|
722
725
|
// Remove old hreflang links first
|
|
723
726
|
document.querySelectorAll('link[rel="alternate"][hreflang]').forEach(el => el.remove());
|
|
724
727
|
Object.entries(alt.languages).forEach(([locale, url]) => {
|
|
725
|
-
const link = document.createElement(
|
|
726
|
-
link.rel =
|
|
728
|
+
const link = document.createElement("link");
|
|
729
|
+
link.rel = "alternate";
|
|
727
730
|
link.hreflang = locale;
|
|
728
731
|
link.href = url;
|
|
729
732
|
document.head.appendChild(link);
|
|
@@ -732,7 +735,7 @@ function applyMetadataToDom(resolved) {
|
|
|
732
735
|
if (alt.media) {
|
|
733
736
|
Object.entries(alt.media).forEach(([mediaQuery, url]) => {
|
|
734
737
|
updateOrCreateLink(`link[rel="alternate"][media="${mediaQuery}"]`, {
|
|
735
|
-
rel:
|
|
738
|
+
rel: "alternate",
|
|
736
739
|
media: mediaQuery,
|
|
737
740
|
href: url
|
|
738
741
|
});
|
|
@@ -743,10 +746,10 @@ function applyMetadataToDom(resolved) {
|
|
|
743
746
|
items.forEach((item, i) => {
|
|
744
747
|
const selector = `link[rel="alternate"][type="${mimeType}"][data-index="${i}"]`;
|
|
745
748
|
const attrs = {
|
|
746
|
-
rel:
|
|
749
|
+
rel: "alternate",
|
|
747
750
|
type: mimeType,
|
|
748
751
|
href: item.url,
|
|
749
|
-
|
|
752
|
+
"data-index": String(i)
|
|
750
753
|
};
|
|
751
754
|
if (item.title) attrs.title = item.title;
|
|
752
755
|
updateOrCreateLink(selector, attrs);
|
|
@@ -756,11 +759,11 @@ function applyMetadataToDom(resolved) {
|
|
|
756
759
|
}
|
|
757
760
|
// ── Icons ───────────────────────────────────────────────────
|
|
758
761
|
if (resolved.icons) {
|
|
759
|
-
applyIcons(resolved.icons.icon,
|
|
760
|
-
applyIcons(resolved.icons.apple,
|
|
762
|
+
applyIcons(resolved.icons.icon, "icon");
|
|
763
|
+
applyIcons(resolved.icons.apple, "apple-touch-icon");
|
|
761
764
|
if (resolved.icons.shortcut) {
|
|
762
765
|
updateOrCreateLink('link[rel="shortcut icon"]', {
|
|
763
|
-
rel:
|
|
766
|
+
rel: "shortcut icon",
|
|
764
767
|
href: resolved.icons.shortcut
|
|
765
768
|
});
|
|
766
769
|
}
|
|
@@ -768,24 +771,24 @@ function applyMetadataToDom(resolved) {
|
|
|
768
771
|
// ── Manifest ────────────────────────────────────────────────
|
|
769
772
|
if (resolved.manifest) {
|
|
770
773
|
updateOrCreateLink('link[rel="manifest"]', {
|
|
771
|
-
rel:
|
|
774
|
+
rel: "manifest",
|
|
772
775
|
href: resolved.manifest
|
|
773
776
|
});
|
|
774
777
|
}
|
|
775
778
|
// ── Structured data JSON-LD ─────────────────────────────────
|
|
776
779
|
if (resolved.structuredData) {
|
|
777
|
-
const schemaScriptId =
|
|
780
|
+
const schemaScriptId = "react-pages-schema-org";
|
|
778
781
|
let scriptElement = document.querySelector(`script[id="${schemaScriptId}"]`);
|
|
779
782
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
780
783
|
if (!scriptElement) {
|
|
781
|
-
scriptElement = document.createElement(
|
|
782
|
-
scriptElement.type =
|
|
784
|
+
scriptElement = document.createElement("script");
|
|
785
|
+
scriptElement.type = "application/ld+json";
|
|
783
786
|
scriptElement.id = schemaScriptId;
|
|
784
787
|
document.head.appendChild(scriptElement);
|
|
785
788
|
}
|
|
786
789
|
scriptElement.textContent = JSON.stringify(Object.assign({
|
|
787
|
-
|
|
788
|
-
|
|
790
|
+
"@context": "https://schema.org",
|
|
791
|
+
"@type": resolved.structuredData.type
|
|
789
792
|
}, resolved.structuredData.schema));
|
|
790
793
|
}
|
|
791
794
|
// ── AI crawler hints ────────────────────────────────────────
|
|
@@ -793,22 +796,22 @@ function applyMetadataToDom(resolved) {
|
|
|
793
796
|
const hints = resolved.aiHints;
|
|
794
797
|
if (hints.contentClassification) {
|
|
795
798
|
updateOrCreateMeta('meta[name="ai-content-classification"]', hints.contentClassification, {
|
|
796
|
-
name:
|
|
799
|
+
name: "ai-content-classification"
|
|
797
800
|
});
|
|
798
801
|
}
|
|
799
802
|
if ((_d = hints.modelHints) === null || _d === void 0 ? void 0 : _d.length) {
|
|
800
|
-
updateOrCreateMeta('meta[name="ai-model-hints"]', hints.modelHints.join(
|
|
801
|
-
name:
|
|
803
|
+
updateOrCreateMeta('meta[name="ai-model-hints"]', hints.modelHints.join(", "), {
|
|
804
|
+
name: "ai-model-hints"
|
|
802
805
|
});
|
|
803
806
|
}
|
|
804
807
|
if (hints.contextualInfo) {
|
|
805
808
|
updateOrCreateMeta('meta[name="ai-context"]', hints.contextualInfo, {
|
|
806
|
-
name:
|
|
809
|
+
name: "ai-context"
|
|
807
810
|
});
|
|
808
811
|
}
|
|
809
812
|
if (hints.excludeFromIndexing) {
|
|
810
|
-
updateOrCreateMeta('meta[name="ai-exclude-from-indexing"]',
|
|
811
|
-
name:
|
|
813
|
+
updateOrCreateMeta('meta[name="ai-exclude-from-indexing"]', "true", {
|
|
814
|
+
name: "ai-exclude-from-indexing"
|
|
812
815
|
});
|
|
813
816
|
}
|
|
814
817
|
}
|
|
@@ -817,9 +820,9 @@ function applyMetadataToDom(resolved) {
|
|
|
817
820
|
const robots = (_e = resolved.robots) !== null && _e !== void 0 ? _e : {};
|
|
818
821
|
const noindex = resolved.disableIndexing || robots.noindex;
|
|
819
822
|
const nofollow = resolved.disableIndexing || robots.nofollow;
|
|
820
|
-
const robotsValue = [noindex ?
|
|
823
|
+
const robotsValue = [noindex ? "noindex" : "index", nofollow ? "nofollow" : "follow", robots.noarchive && "noarchive", robots.nosnippet && "nosnippet", robots.maxImagePreview && `max-image-preview:${robots.maxImagePreview}`, robots.maxSnippet != null && `max-snippet:${robots.maxSnippet}`].filter(Boolean).join(", ");
|
|
821
824
|
updateOrCreateMeta('meta[name="robots"]', robotsValue, {
|
|
822
|
-
name:
|
|
825
|
+
name: "robots"
|
|
823
826
|
});
|
|
824
827
|
}
|
|
825
828
|
// ── Custom meta tags ────────────────────────────────────────
|
|
@@ -831,7 +834,7 @@ function applyMetadataToDom(resolved) {
|
|
|
831
834
|
} : tag.property ? {
|
|
832
835
|
property: tag.property
|
|
833
836
|
} : tag.httpEquiv ? {
|
|
834
|
-
|
|
837
|
+
"http-equiv": tag.httpEquiv
|
|
835
838
|
} : {};
|
|
836
839
|
if (tag.id) attributes.id = tag.id;
|
|
837
840
|
updateOrCreateMeta(selector, tag.content, attributes);
|
|
@@ -843,32 +846,32 @@ function applyOgImages(images) {
|
|
|
843
846
|
// Remove existing OG image tags to avoid stale data
|
|
844
847
|
document.querySelectorAll('meta[property="og:image"], meta[property="og:image:alt"], meta[property="og:image:width"], meta[property="og:image:height"], meta[property="og:image:type"]').forEach(el => el.remove());
|
|
845
848
|
images.forEach(img => {
|
|
846
|
-
const ogImg = document.createElement(
|
|
847
|
-
ogImg.setAttribute(
|
|
848
|
-
ogImg.setAttribute(
|
|
849
|
+
const ogImg = document.createElement("meta");
|
|
850
|
+
ogImg.setAttribute("property", "og:image");
|
|
851
|
+
ogImg.setAttribute("content", img.url);
|
|
849
852
|
document.head.appendChild(ogImg);
|
|
850
853
|
if (img.alt) {
|
|
851
|
-
const altMeta = document.createElement(
|
|
852
|
-
altMeta.setAttribute(
|
|
853
|
-
altMeta.setAttribute(
|
|
854
|
+
const altMeta = document.createElement("meta");
|
|
855
|
+
altMeta.setAttribute("property", "og:image:alt");
|
|
856
|
+
altMeta.setAttribute("content", img.alt);
|
|
854
857
|
document.head.appendChild(altMeta);
|
|
855
858
|
}
|
|
856
859
|
if (img.width) {
|
|
857
|
-
const wMeta = document.createElement(
|
|
858
|
-
wMeta.setAttribute(
|
|
859
|
-
wMeta.setAttribute(
|
|
860
|
+
const wMeta = document.createElement("meta");
|
|
861
|
+
wMeta.setAttribute("property", "og:image:width");
|
|
862
|
+
wMeta.setAttribute("content", String(img.width));
|
|
860
863
|
document.head.appendChild(wMeta);
|
|
861
864
|
}
|
|
862
865
|
if (img.height) {
|
|
863
|
-
const hMeta = document.createElement(
|
|
864
|
-
hMeta.setAttribute(
|
|
865
|
-
hMeta.setAttribute(
|
|
866
|
+
const hMeta = document.createElement("meta");
|
|
867
|
+
hMeta.setAttribute("property", "og:image:height");
|
|
868
|
+
hMeta.setAttribute("content", String(img.height));
|
|
866
869
|
document.head.appendChild(hMeta);
|
|
867
870
|
}
|
|
868
871
|
if (img.type) {
|
|
869
|
-
const tMeta = document.createElement(
|
|
870
|
-
tMeta.setAttribute(
|
|
871
|
-
tMeta.setAttribute(
|
|
872
|
+
const tMeta = document.createElement("meta");
|
|
873
|
+
tMeta.setAttribute("property", "og:image:type");
|
|
874
|
+
tMeta.setAttribute("content", img.type);
|
|
872
875
|
document.head.appendChild(tMeta);
|
|
873
876
|
}
|
|
874
877
|
});
|
|
@@ -876,18 +879,18 @@ function applyOgImages(images) {
|
|
|
876
879
|
/** Apply icon link tags to the DOM */
|
|
877
880
|
function applyIcons(icons, rel) {
|
|
878
881
|
if (!icons) return;
|
|
879
|
-
const iconList = typeof icons ===
|
|
882
|
+
const iconList = typeof icons === "string" ? [{
|
|
880
883
|
url: icons
|
|
881
884
|
}] : Array.isArray(icons) ? icons : [icons];
|
|
882
885
|
// Remove old icons of this rel
|
|
883
886
|
document.querySelectorAll(`link[rel="${rel}"]`).forEach(el => el.remove());
|
|
884
887
|
iconList.forEach(icon => {
|
|
885
|
-
const link = document.createElement(
|
|
888
|
+
const link = document.createElement("link");
|
|
886
889
|
link.rel = rel;
|
|
887
890
|
link.href = icon.url;
|
|
888
891
|
if (icon.type) link.type = icon.type;
|
|
889
|
-
if (icon.sizes) link.setAttribute(
|
|
890
|
-
if (icon.color) link.setAttribute(
|
|
892
|
+
if (icon.sizes) link.setAttribute("sizes", icon.sizes);
|
|
893
|
+
if (icon.color) link.setAttribute("color", icon.color);
|
|
891
894
|
document.head.appendChild(link);
|
|
892
895
|
});
|
|
893
896
|
}
|
|
@@ -909,7 +912,7 @@ function collectMetadataToHtml(resolved) {
|
|
|
909
912
|
tags.push(`<link rel="canonical" href="${escapeAttr(resolved.canonical)}" />`);
|
|
910
913
|
}
|
|
911
914
|
if ((_a = resolved.keywords) === null || _a === void 0 ? void 0 : _a.length) {
|
|
912
|
-
tags.push(`<meta name="keywords" content="${escapeAttr(resolved.keywords.join(
|
|
915
|
+
tags.push(`<meta name="keywords" content="${escapeAttr(resolved.keywords.join(", "))}" />`);
|
|
913
916
|
}
|
|
914
917
|
if (resolved.author) {
|
|
915
918
|
tags.push(`<meta name="author" content="${escapeAttr(resolved.author)}" />`);
|
|
@@ -923,42 +926,42 @@ function collectMetadataToHtml(resolved) {
|
|
|
923
926
|
// Open Graph
|
|
924
927
|
if (resolved.openGraph) {
|
|
925
928
|
const og = resolved.openGraph;
|
|
926
|
-
if (og.type) tags.push(ogMeta(
|
|
927
|
-
if (og.title) tags.push(ogMeta(
|
|
928
|
-
if (og.description) tags.push(ogMeta(
|
|
929
|
-
if (og.url) tags.push(ogMeta(
|
|
930
|
-
if (og.siteName) tags.push(ogMeta(
|
|
931
|
-
if (og.locale) tags.push(ogMeta(
|
|
932
|
-
const images = (_b = og.images) !== null && _b !== void 0 ? _b : og.image ? [typeof og.image ===
|
|
929
|
+
if (og.type) tags.push(ogMeta("og:type", og.type));
|
|
930
|
+
if (og.title) tags.push(ogMeta("og:title", og.title));
|
|
931
|
+
if (og.description) tags.push(ogMeta("og:description", og.description));
|
|
932
|
+
if (og.url) tags.push(ogMeta("og:url", og.url));
|
|
933
|
+
if (og.siteName) tags.push(ogMeta("og:site_name", og.siteName));
|
|
934
|
+
if (og.locale) tags.push(ogMeta("og:locale", og.locale));
|
|
935
|
+
const images = (_b = og.images) !== null && _b !== void 0 ? _b : og.image ? [typeof og.image === "string" ? {
|
|
933
936
|
url: og.image
|
|
934
937
|
} : og.image] : [];
|
|
935
938
|
images.forEach(img => {
|
|
936
|
-
tags.push(ogMeta(
|
|
937
|
-
if (img.alt) tags.push(ogMeta(
|
|
938
|
-
if (img.width) tags.push(ogMeta(
|
|
939
|
-
if (img.height) tags.push(ogMeta(
|
|
940
|
-
if (img.type) tags.push(ogMeta(
|
|
939
|
+
tags.push(ogMeta("og:image", img.url));
|
|
940
|
+
if (img.alt) tags.push(ogMeta("og:image:alt", img.alt));
|
|
941
|
+
if (img.width) tags.push(ogMeta("og:image:width", String(img.width)));
|
|
942
|
+
if (img.height) tags.push(ogMeta("og:image:height", String(img.height)));
|
|
943
|
+
if (img.type) tags.push(ogMeta("og:image:type", img.type));
|
|
941
944
|
});
|
|
942
945
|
if (og.article) {
|
|
943
946
|
const art = og.article;
|
|
944
|
-
if (art.publishedTime) tags.push(ogMeta(
|
|
945
|
-
if (art.modifiedTime) tags.push(ogMeta(
|
|
946
|
-
if (art.section) tags.push(ogMeta(
|
|
947
|
+
if (art.publishedTime) tags.push(ogMeta("article:published_time", art.publishedTime));
|
|
948
|
+
if (art.modifiedTime) tags.push(ogMeta("article:modified_time", art.modifiedTime));
|
|
949
|
+
if (art.section) tags.push(ogMeta("article:section", art.section));
|
|
947
950
|
const authors = Array.isArray(art.author) ? art.author : art.author ? [art.author] : [];
|
|
948
|
-
authors.forEach(a => tags.push(ogMeta(
|
|
949
|
-
(_c = art.tags) === null || _c === void 0 ? void 0 : _c.forEach(t => tags.push(ogMeta(
|
|
951
|
+
authors.forEach(a => tags.push(ogMeta("article:author", a)));
|
|
952
|
+
(_c = art.tags) === null || _c === void 0 ? void 0 : _c.forEach(t => tags.push(ogMeta("article:tag", t)));
|
|
950
953
|
}
|
|
951
954
|
}
|
|
952
955
|
// Twitter Card
|
|
953
956
|
if (resolved.twitter) {
|
|
954
957
|
const tw = resolved.twitter;
|
|
955
|
-
if (tw.card) tags.push(nameMeta(
|
|
956
|
-
if (tw.site) tags.push(nameMeta(
|
|
957
|
-
if (tw.creator) tags.push(nameMeta(
|
|
958
|
-
if (tw.title) tags.push(nameMeta(
|
|
959
|
-
if (tw.description) tags.push(nameMeta(
|
|
960
|
-
if (tw.image) tags.push(nameMeta(
|
|
961
|
-
if (tw.imageAlt) tags.push(nameMeta(
|
|
958
|
+
if (tw.card) tags.push(nameMeta("twitter:card", tw.card));
|
|
959
|
+
if (tw.site) tags.push(nameMeta("twitter:site", tw.site));
|
|
960
|
+
if (tw.creator) tags.push(nameMeta("twitter:creator", tw.creator));
|
|
961
|
+
if (tw.title) tags.push(nameMeta("twitter:title", tw.title));
|
|
962
|
+
if (tw.description) tags.push(nameMeta("twitter:description", tw.description));
|
|
963
|
+
if (tw.image) tags.push(nameMeta("twitter:image", tw.image));
|
|
964
|
+
if (tw.imageAlt) tags.push(nameMeta("twitter:image:alt", tw.imageAlt));
|
|
962
965
|
}
|
|
963
966
|
// Alternates / hreflang
|
|
964
967
|
if ((_d = resolved.alternates) === null || _d === void 0 ? void 0 : _d.languages) {
|
|
@@ -968,8 +971,8 @@ function collectMetadataToHtml(resolved) {
|
|
|
968
971
|
}
|
|
969
972
|
// Icons
|
|
970
973
|
if (resolved.icons) {
|
|
971
|
-
collectIconTags(resolved.icons.icon,
|
|
972
|
-
collectIconTags(resolved.icons.apple,
|
|
974
|
+
collectIconTags(resolved.icons.icon, "icon", tags);
|
|
975
|
+
collectIconTags(resolved.icons.apple, "apple-touch-icon", tags);
|
|
973
976
|
if (resolved.icons.shortcut) {
|
|
974
977
|
tags.push(`<link rel="shortcut icon" href="${escapeAttr(resolved.icons.shortcut)}" />`);
|
|
975
978
|
}
|
|
@@ -981,8 +984,8 @@ function collectMetadataToHtml(resolved) {
|
|
|
981
984
|
// Structured data JSON-LD
|
|
982
985
|
if (resolved.structuredData) {
|
|
983
986
|
const jsonLd = JSON.stringify(Object.assign({
|
|
984
|
-
|
|
985
|
-
|
|
987
|
+
"@context": "https://schema.org",
|
|
988
|
+
"@type": resolved.structuredData.type
|
|
986
989
|
}, resolved.structuredData.schema));
|
|
987
990
|
tags.push(`<script type="application/ld+json">${jsonLd}</script>`);
|
|
988
991
|
}
|
|
@@ -991,7 +994,7 @@ function collectMetadataToHtml(resolved) {
|
|
|
991
994
|
const robots = (_e = resolved.robots) !== null && _e !== void 0 ? _e : {};
|
|
992
995
|
const noindex = resolved.disableIndexing || robots.noindex;
|
|
993
996
|
const nofollow = resolved.disableIndexing || robots.nofollow;
|
|
994
|
-
const robotsValue = [noindex ?
|
|
997
|
+
const robotsValue = [noindex ? "noindex" : "index", nofollow ? "nofollow" : "follow", robots.noarchive && "noarchive", robots.nosnippet && "nosnippet", robots.maxImagePreview && `max-image-preview:${robots.maxImagePreview}`, robots.maxSnippet != null && `max-snippet:${robots.maxSnippet}`].filter(Boolean).join(", ");
|
|
995
998
|
tags.push(`<meta name="robots" content="${escapeAttr(robotsValue)}" />`);
|
|
996
999
|
}
|
|
997
1000
|
// Custom meta tags
|
|
@@ -1004,11 +1007,11 @@ function collectMetadataToHtml(resolved) {
|
|
|
1004
1007
|
tags.push(`<meta http-equiv="${escapeAttr(tag.httpEquiv)}" content="${escapeAttr(tag.content)}" />`);
|
|
1005
1008
|
}
|
|
1006
1009
|
});
|
|
1007
|
-
return tags.join(
|
|
1010
|
+
return tags.join("\n");
|
|
1008
1011
|
}
|
|
1009
1012
|
function collectIconTags(icons, rel, tags) {
|
|
1010
1013
|
if (!icons) return;
|
|
1011
|
-
const iconList = typeof icons ===
|
|
1014
|
+
const iconList = typeof icons === "string" ? [{
|
|
1012
1015
|
url: icons
|
|
1013
1016
|
}] : Array.isArray(icons) ? icons : [icons];
|
|
1014
1017
|
iconList.forEach(icon => {
|
|
@@ -1016,16 +1019,16 @@ function collectIconTags(icons, rel, tags) {
|
|
|
1016
1019
|
if (icon.type) tag += ` type="${escapeAttr(icon.type)}"`;
|
|
1017
1020
|
if (icon.sizes) tag += ` sizes="${escapeAttr(icon.sizes)}"`;
|
|
1018
1021
|
if (icon.color) tag += ` color="${escapeAttr(icon.color)}"`;
|
|
1019
|
-
tag +=
|
|
1022
|
+
tag += " />";
|
|
1020
1023
|
tags.push(tag);
|
|
1021
1024
|
});
|
|
1022
1025
|
}
|
|
1023
1026
|
// ─── HTML helpers ────────────────────────────────────────────
|
|
1024
1027
|
function escapeHtml(str) {
|
|
1025
|
-
return str.replace(/&/g,
|
|
1028
|
+
return str.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
1026
1029
|
}
|
|
1027
1030
|
function escapeAttr(str) {
|
|
1028
|
-
return str.replace(/&/g,
|
|
1031
|
+
return str.replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<").replace(/>/g, ">");
|
|
1029
1032
|
}
|
|
1030
1033
|
function ogMeta(property, content) {
|
|
1031
1034
|
return `<meta property="${escapeAttr(property)}" content="${escapeAttr(content)}" />`;
|
|
@@ -1080,7 +1083,7 @@ const resetMetadata = () => {
|
|
|
1080
1083
|
*/
|
|
1081
1084
|
function evaluate(value, ctx) {
|
|
1082
1085
|
if (value === undefined || value === null) return undefined;
|
|
1083
|
-
if (typeof value ===
|
|
1086
|
+
if (typeof value === "function") {
|
|
1084
1087
|
return value(ctx);
|
|
1085
1088
|
}
|
|
1086
1089
|
return value;
|
|
@@ -1125,7 +1128,7 @@ function resolveMetadata(meta, ctx) {
|
|
|
1125
1128
|
};
|
|
1126
1129
|
// Normalize: if single image string, also put it in images array
|
|
1127
1130
|
if (resolvedImage && !resolvedImages) {
|
|
1128
|
-
const imgObj = typeof resolvedImage ===
|
|
1131
|
+
const imgObj = typeof resolvedImage === "string" ? {
|
|
1129
1132
|
url: resolvedImage
|
|
1130
1133
|
} : resolvedImage;
|
|
1131
1134
|
resolved.openGraph.images = [imgObj];
|
|
@@ -1160,7 +1163,7 @@ function resolveMetadata(meta, ctx) {
|
|
|
1160
1163
|
const sd = meta.structuredData;
|
|
1161
1164
|
resolved.structuredData = {
|
|
1162
1165
|
type: sd.type,
|
|
1163
|
-
schema: typeof sd.schema ===
|
|
1166
|
+
schema: typeof sd.schema === "function" ? sd.schema(ctx) : sd.schema
|
|
1164
1167
|
};
|
|
1165
1168
|
}
|
|
1166
1169
|
// ── AI Hints ────────────────────────────────────────────────
|
|
@@ -1248,7 +1251,7 @@ function useMetadataStore() {
|
|
|
1248
1251
|
*
|
|
1249
1252
|
* @module config/metadataLogger
|
|
1250
1253
|
*/
|
|
1251
|
-
const isDev = process.env.NODE_ENV ===
|
|
1254
|
+
const isDev = process.env.NODE_ENV === "development";
|
|
1252
1255
|
let logEnabled = false;
|
|
1253
1256
|
const logEntries = [];
|
|
1254
1257
|
/**
|
|
@@ -1275,7 +1278,7 @@ function logMetadata(pageId, action, metadata) {
|
|
|
1275
1278
|
if (logEntries.length > 50) {
|
|
1276
1279
|
logEntries.splice(0, logEntries.length - 50);
|
|
1277
1280
|
}
|
|
1278
|
-
console.log(`[Metadata:${action}] page="${pageId}"`, metadata.title ? `title="${metadata.title}"` :
|
|
1281
|
+
console.log(`[Metadata:${action}] page="${pageId}"`, metadata.title ? `title="${metadata.title}"` : "", metadata.description ? `desc="${metadata.description.slice(0, 60)}..."` : "");
|
|
1279
1282
|
}
|
|
1280
1283
|
/**
|
|
1281
1284
|
* Get all logged metadata entries (dev only).
|
|
@@ -1319,15 +1322,7 @@ let _pageConfig = {
|
|
|
1319
1322
|
defaultMetadata: {},
|
|
1320
1323
|
setMetadata,
|
|
1321
1324
|
getMetadata,
|
|
1322
|
-
resetMetadata
|
|
1323
|
-
// Lazy loading configuration
|
|
1324
|
-
lazyLoading: {
|
|
1325
|
-
enabled: true,
|
|
1326
|
-
preloadOnHover: false,
|
|
1327
|
-
preloadOnFocus: false,
|
|
1328
|
-
timeout: 30000,
|
|
1329
|
-
logMetrics: process.env.NODE_ENV === "development"
|
|
1330
|
-
}
|
|
1325
|
+
resetMetadata
|
|
1331
1326
|
};
|
|
1332
1327
|
/**
|
|
1333
1328
|
* Get or initialize the page configuration singleton
|
|
@@ -1357,15 +1352,7 @@ function initializePageConfig() {
|
|
|
1357
1352
|
defaultMetadata: {},
|
|
1358
1353
|
setMetadata,
|
|
1359
1354
|
getMetadata,
|
|
1360
|
-
resetMetadata
|
|
1361
|
-
// Lazy loading configuration
|
|
1362
|
-
lazyLoading: {
|
|
1363
|
-
enabled: true,
|
|
1364
|
-
preloadOnHover: false,
|
|
1365
|
-
preloadOnFocus: false,
|
|
1366
|
-
timeout: 30000,
|
|
1367
|
-
logMetrics: process.env.NODE_ENV === "development"
|
|
1368
|
-
}
|
|
1355
|
+
resetMetadata
|
|
1369
1356
|
};
|
|
1370
1357
|
return _pageConfig;
|
|
1371
1358
|
}
|
|
@@ -1548,14 +1535,13 @@ function useFormData({
|
|
|
1548
1535
|
};
|
|
1549
1536
|
};const EMPTY_ARRAY = [];
|
|
1550
1537
|
const usePageConfig = t0 => {
|
|
1551
|
-
const $ = c(
|
|
1538
|
+
const $ = c(27);
|
|
1552
1539
|
const {
|
|
1553
1540
|
queries: t1,
|
|
1554
1541
|
form,
|
|
1555
1542
|
ns,
|
|
1556
1543
|
viewSettings: t2,
|
|
1557
1544
|
meta,
|
|
1558
|
-
lazyLoading,
|
|
1559
1545
|
variables,
|
|
1560
1546
|
pageId
|
|
1561
1547
|
} = t0;
|
|
@@ -1670,24 +1656,22 @@ const usePageConfig = t0 => {
|
|
|
1670
1656
|
}
|
|
1671
1657
|
const mappedViewSettings = useViewSettings(t8);
|
|
1672
1658
|
let t9;
|
|
1673
|
-
if ($[21] !== form || $[22] !== formData || $[23] !== globalConfig || $[24] !==
|
|
1659
|
+
if ($[21] !== form || $[22] !== formData || $[23] !== globalConfig || $[24] !== mappedViewSettings || $[25] !== meta) {
|
|
1674
1660
|
t9 = {
|
|
1675
1661
|
formData,
|
|
1676
1662
|
form,
|
|
1677
1663
|
mappedViewSettings,
|
|
1678
1664
|
meta,
|
|
1679
|
-
lazyLoading,
|
|
1680
1665
|
globalConfig
|
|
1681
1666
|
};
|
|
1682
1667
|
$[21] = form;
|
|
1683
1668
|
$[22] = formData;
|
|
1684
1669
|
$[23] = globalConfig;
|
|
1685
|
-
$[24] =
|
|
1686
|
-
$[25] =
|
|
1687
|
-
$[26] =
|
|
1688
|
-
$[27] = t9;
|
|
1670
|
+
$[24] = mappedViewSettings;
|
|
1671
|
+
$[25] = meta;
|
|
1672
|
+
$[26] = t9;
|
|
1689
1673
|
} else {
|
|
1690
|
-
t9 = $[
|
|
1674
|
+
t9 = $[26];
|
|
1691
1675
|
}
|
|
1692
1676
|
const mergedConfig = t9;
|
|
1693
1677
|
return mergedConfig;
|
|
@@ -1722,7 +1706,7 @@ function useMetadata({
|
|
|
1722
1706
|
// Step 1: Evaluate metadata (if function)
|
|
1723
1707
|
const evaluatedMeta = useMemo(() => {
|
|
1724
1708
|
if (!meta) return {};
|
|
1725
|
-
if (typeof meta ===
|
|
1709
|
+
if (typeof meta === "function") {
|
|
1726
1710
|
return meta({
|
|
1727
1711
|
get,
|
|
1728
1712
|
set
|
|
@@ -1742,25 +1726,25 @@ function useMetadata({
|
|
|
1742
1726
|
// Translate basic fields
|
|
1743
1727
|
if (result.title) {
|
|
1744
1728
|
result.title = t(result.title, {
|
|
1745
|
-
ns:
|
|
1729
|
+
ns: "meta",
|
|
1746
1730
|
defaultValue: result.title
|
|
1747
1731
|
});
|
|
1748
1732
|
}
|
|
1749
1733
|
if (result.description) {
|
|
1750
1734
|
result.description = t(result.description, {
|
|
1751
|
-
ns:
|
|
1735
|
+
ns: "meta",
|
|
1752
1736
|
defaultValue: result.description
|
|
1753
1737
|
});
|
|
1754
1738
|
}
|
|
1755
1739
|
if (result.keywords) {
|
|
1756
1740
|
result.keywords = result.keywords.map(kw => t(kw, {
|
|
1757
|
-
ns:
|
|
1741
|
+
ns: "meta",
|
|
1758
1742
|
defaultValue: kw
|
|
1759
1743
|
}));
|
|
1760
1744
|
}
|
|
1761
1745
|
if (result.author) {
|
|
1762
1746
|
result.author = t(result.author, {
|
|
1763
|
-
ns:
|
|
1747
|
+
ns: "meta",
|
|
1764
1748
|
defaultValue: result.author
|
|
1765
1749
|
});
|
|
1766
1750
|
}
|
|
@@ -1769,19 +1753,19 @@ function useMetadata({
|
|
|
1769
1753
|
result.openGraph = Object.assign({}, result.openGraph);
|
|
1770
1754
|
if (result.openGraph.title) {
|
|
1771
1755
|
result.openGraph.title = t(result.openGraph.title, {
|
|
1772
|
-
ns:
|
|
1756
|
+
ns: "meta",
|
|
1773
1757
|
defaultValue: result.openGraph.title
|
|
1774
1758
|
});
|
|
1775
1759
|
}
|
|
1776
1760
|
if (result.openGraph.description) {
|
|
1777
1761
|
result.openGraph.description = t(result.openGraph.description, {
|
|
1778
|
-
ns:
|
|
1762
|
+
ns: "meta",
|
|
1779
1763
|
defaultValue: result.openGraph.description
|
|
1780
1764
|
});
|
|
1781
1765
|
}
|
|
1782
1766
|
if (result.openGraph.siteName) {
|
|
1783
1767
|
result.openGraph.siteName = t(result.openGraph.siteName, {
|
|
1784
|
-
ns:
|
|
1768
|
+
ns: "meta",
|
|
1785
1769
|
defaultValue: result.openGraph.siteName
|
|
1786
1770
|
});
|
|
1787
1771
|
}
|
|
@@ -1791,13 +1775,13 @@ function useMetadata({
|
|
|
1791
1775
|
result.twitter = Object.assign({}, result.twitter);
|
|
1792
1776
|
if (result.twitter.title) {
|
|
1793
1777
|
result.twitter.title = t(result.twitter.title, {
|
|
1794
|
-
ns:
|
|
1778
|
+
ns: "meta",
|
|
1795
1779
|
defaultValue: result.twitter.title
|
|
1796
1780
|
});
|
|
1797
1781
|
}
|
|
1798
1782
|
if (result.twitter.description) {
|
|
1799
1783
|
result.twitter.description = t(result.twitter.description, {
|
|
1800
|
-
ns:
|
|
1784
|
+
ns: "meta",
|
|
1801
1785
|
defaultValue: result.twitter.description
|
|
1802
1786
|
});
|
|
1803
1787
|
}
|
|
@@ -1814,7 +1798,7 @@ function useMetadata({
|
|
|
1814
1798
|
metadataStore.setMetadata(translated);
|
|
1815
1799
|
}
|
|
1816
1800
|
// On the client, also apply to DOM
|
|
1817
|
-
if (typeof document !==
|
|
1801
|
+
if (typeof document !== "undefined") {
|
|
1818
1802
|
applyMetadataToDom(translated);
|
|
1819
1803
|
}
|
|
1820
1804
|
}, [translated, autoApply, metadataStore]);
|
|
@@ -1908,7 +1892,7 @@ const MetadataManagerImpl = t0 => {
|
|
|
1908
1892
|
useMetadata(t2);
|
|
1909
1893
|
return null;
|
|
1910
1894
|
};
|
|
1911
|
-
MetadataManagerImpl.displayName =
|
|
1895
|
+
MetadataManagerImpl.displayName = "MetadataManager";
|
|
1912
1896
|
const MetadataManager = MetadataManagerImpl;const PageGenerator = _a => {
|
|
1913
1897
|
var {
|
|
1914
1898
|
enableAuthControl = true,
|
|
@@ -2211,8 +2195,8 @@ function toNextMetadata(resolved) {
|
|
|
2211
2195
|
follow: !(resolved.disableIndexing || r.nofollow),
|
|
2212
2196
|
noarchive: r.noarchive,
|
|
2213
2197
|
nosnippet: r.nosnippet,
|
|
2214
|
-
|
|
2215
|
-
|
|
2198
|
+
"max-image-preview": r.maxImagePreview,
|
|
2199
|
+
"max-snippet": r.maxSnippet
|
|
2216
2200
|
};
|
|
2217
2201
|
}
|
|
2218
2202
|
// Alternates
|
|
@@ -2278,7 +2262,7 @@ function toNextMetadata(resolved) {
|
|
|
2278
2262
|
const icons = resolved.icons;
|
|
2279
2263
|
const nextIcons = {};
|
|
2280
2264
|
if (icons.icon) {
|
|
2281
|
-
const list = typeof icons.icon ===
|
|
2265
|
+
const list = typeof icons.icon === "string" ? [{
|
|
2282
2266
|
url: icons.icon
|
|
2283
2267
|
}] : Array.isArray(icons.icon) ? icons.icon : [icons.icon];
|
|
2284
2268
|
nextIcons.icon = list.map(i => ({
|
|
@@ -2288,7 +2272,7 @@ function toNextMetadata(resolved) {
|
|
|
2288
2272
|
}));
|
|
2289
2273
|
}
|
|
2290
2274
|
if (icons.apple) {
|
|
2291
|
-
const list = typeof icons.apple ===
|
|
2275
|
+
const list = typeof icons.apple === "string" ? [{
|
|
2292
2276
|
url: icons.apple
|
|
2293
2277
|
}] : Array.isArray(icons.apple) ? icons.apple : [icons.apple];
|
|
2294
2278
|
nextIcons.apple = list.map(i => ({
|
|
@@ -2309,68 +2293,68 @@ function toNextHeadTags(resolved) {
|
|
|
2309
2293
|
const tags = [];
|
|
2310
2294
|
if (resolved.title) {
|
|
2311
2295
|
tags.push({
|
|
2312
|
-
key:
|
|
2313
|
-
tag:
|
|
2296
|
+
key: "title",
|
|
2297
|
+
tag: "title",
|
|
2314
2298
|
attributes: {},
|
|
2315
2299
|
content: resolved.title
|
|
2316
2300
|
});
|
|
2317
2301
|
}
|
|
2318
2302
|
if (resolved.description) {
|
|
2319
2303
|
tags.push({
|
|
2320
|
-
key:
|
|
2321
|
-
tag:
|
|
2304
|
+
key: "desc",
|
|
2305
|
+
tag: "meta",
|
|
2322
2306
|
attributes: {
|
|
2323
|
-
name:
|
|
2307
|
+
name: "description",
|
|
2324
2308
|
content: resolved.description
|
|
2325
2309
|
}
|
|
2326
2310
|
});
|
|
2327
2311
|
}
|
|
2328
2312
|
if (resolved.canonical) {
|
|
2329
2313
|
tags.push({
|
|
2330
|
-
key:
|
|
2331
|
-
tag:
|
|
2314
|
+
key: "canonical",
|
|
2315
|
+
tag: "link",
|
|
2332
2316
|
attributes: {
|
|
2333
|
-
rel:
|
|
2317
|
+
rel: "canonical",
|
|
2334
2318
|
href: resolved.canonical
|
|
2335
2319
|
}
|
|
2336
2320
|
});
|
|
2337
2321
|
}
|
|
2338
2322
|
if ((_a = resolved.keywords) === null || _a === void 0 ? void 0 : _a.length) {
|
|
2339
2323
|
tags.push({
|
|
2340
|
-
key:
|
|
2341
|
-
tag:
|
|
2324
|
+
key: "keywords",
|
|
2325
|
+
tag: "meta",
|
|
2342
2326
|
attributes: {
|
|
2343
|
-
name:
|
|
2344
|
-
content: resolved.keywords.join(
|
|
2327
|
+
name: "keywords",
|
|
2328
|
+
content: resolved.keywords.join(", ")
|
|
2345
2329
|
}
|
|
2346
2330
|
});
|
|
2347
2331
|
}
|
|
2348
2332
|
if (resolved.author) {
|
|
2349
2333
|
tags.push({
|
|
2350
|
-
key:
|
|
2351
|
-
tag:
|
|
2334
|
+
key: "author",
|
|
2335
|
+
tag: "meta",
|
|
2352
2336
|
attributes: {
|
|
2353
|
-
name:
|
|
2337
|
+
name: "author",
|
|
2354
2338
|
content: resolved.author
|
|
2355
2339
|
}
|
|
2356
2340
|
});
|
|
2357
2341
|
}
|
|
2358
2342
|
if (resolved.viewport) {
|
|
2359
2343
|
tags.push({
|
|
2360
|
-
key:
|
|
2361
|
-
tag:
|
|
2344
|
+
key: "viewport",
|
|
2345
|
+
tag: "meta",
|
|
2362
2346
|
attributes: {
|
|
2363
|
-
name:
|
|
2347
|
+
name: "viewport",
|
|
2364
2348
|
content: resolved.viewport
|
|
2365
2349
|
}
|
|
2366
2350
|
});
|
|
2367
2351
|
}
|
|
2368
2352
|
if (resolved.themeColor) {
|
|
2369
2353
|
tags.push({
|
|
2370
|
-
key:
|
|
2371
|
-
tag:
|
|
2354
|
+
key: "theme-color",
|
|
2355
|
+
tag: "meta",
|
|
2372
2356
|
attributes: {
|
|
2373
|
-
name:
|
|
2357
|
+
name: "theme-color",
|
|
2374
2358
|
content: resolved.themeColor
|
|
2375
2359
|
}
|
|
2376
2360
|
});
|
|
@@ -2379,50 +2363,50 @@ function toNextHeadTags(resolved) {
|
|
|
2379
2363
|
if (resolved.openGraph) {
|
|
2380
2364
|
const og = resolved.openGraph;
|
|
2381
2365
|
if (og.type) tags.push({
|
|
2382
|
-
key:
|
|
2383
|
-
tag:
|
|
2366
|
+
key: "og:type",
|
|
2367
|
+
tag: "meta",
|
|
2384
2368
|
attributes: {
|
|
2385
|
-
property:
|
|
2369
|
+
property: "og:type",
|
|
2386
2370
|
content: og.type
|
|
2387
2371
|
}
|
|
2388
2372
|
});
|
|
2389
2373
|
if (og.title) tags.push({
|
|
2390
|
-
key:
|
|
2391
|
-
tag:
|
|
2374
|
+
key: "og:title",
|
|
2375
|
+
tag: "meta",
|
|
2392
2376
|
attributes: {
|
|
2393
|
-
property:
|
|
2377
|
+
property: "og:title",
|
|
2394
2378
|
content: og.title
|
|
2395
2379
|
}
|
|
2396
2380
|
});
|
|
2397
2381
|
if (og.description) tags.push({
|
|
2398
|
-
key:
|
|
2399
|
-
tag:
|
|
2382
|
+
key: "og:desc",
|
|
2383
|
+
tag: "meta",
|
|
2400
2384
|
attributes: {
|
|
2401
|
-
property:
|
|
2385
|
+
property: "og:description",
|
|
2402
2386
|
content: og.description
|
|
2403
2387
|
}
|
|
2404
2388
|
});
|
|
2405
2389
|
if (og.url) tags.push({
|
|
2406
|
-
key:
|
|
2407
|
-
tag:
|
|
2390
|
+
key: "og:url",
|
|
2391
|
+
tag: "meta",
|
|
2408
2392
|
attributes: {
|
|
2409
|
-
property:
|
|
2393
|
+
property: "og:url",
|
|
2410
2394
|
content: og.url
|
|
2411
2395
|
}
|
|
2412
2396
|
});
|
|
2413
2397
|
if (og.siteName) tags.push({
|
|
2414
|
-
key:
|
|
2415
|
-
tag:
|
|
2398
|
+
key: "og:site",
|
|
2399
|
+
tag: "meta",
|
|
2416
2400
|
attributes: {
|
|
2417
|
-
property:
|
|
2401
|
+
property: "og:site_name",
|
|
2418
2402
|
content: og.siteName
|
|
2419
2403
|
}
|
|
2420
2404
|
});
|
|
2421
2405
|
if (og.locale) tags.push({
|
|
2422
|
-
key:
|
|
2423
|
-
tag:
|
|
2406
|
+
key: "og:locale",
|
|
2407
|
+
tag: "meta",
|
|
2424
2408
|
attributes: {
|
|
2425
|
-
property:
|
|
2409
|
+
property: "og:locale",
|
|
2426
2410
|
content: og.locale
|
|
2427
2411
|
}
|
|
2428
2412
|
});
|
|
@@ -2430,33 +2414,33 @@ function toNextHeadTags(resolved) {
|
|
|
2430
2414
|
images.forEach((img, i) => {
|
|
2431
2415
|
tags.push({
|
|
2432
2416
|
key: `og:img:${i}`,
|
|
2433
|
-
tag:
|
|
2417
|
+
tag: "meta",
|
|
2434
2418
|
attributes: {
|
|
2435
|
-
property:
|
|
2419
|
+
property: "og:image",
|
|
2436
2420
|
content: img.url
|
|
2437
2421
|
}
|
|
2438
2422
|
});
|
|
2439
2423
|
if (img.alt) tags.push({
|
|
2440
2424
|
key: `og:img:alt:${i}`,
|
|
2441
|
-
tag:
|
|
2425
|
+
tag: "meta",
|
|
2442
2426
|
attributes: {
|
|
2443
|
-
property:
|
|
2427
|
+
property: "og:image:alt",
|
|
2444
2428
|
content: img.alt
|
|
2445
2429
|
}
|
|
2446
2430
|
});
|
|
2447
2431
|
if (img.width) tags.push({
|
|
2448
2432
|
key: `og:img:w:${i}`,
|
|
2449
|
-
tag:
|
|
2433
|
+
tag: "meta",
|
|
2450
2434
|
attributes: {
|
|
2451
|
-
property:
|
|
2435
|
+
property: "og:image:width",
|
|
2452
2436
|
content: String(img.width)
|
|
2453
2437
|
}
|
|
2454
2438
|
});
|
|
2455
2439
|
if (img.height) tags.push({
|
|
2456
2440
|
key: `og:img:h:${i}`,
|
|
2457
|
-
tag:
|
|
2441
|
+
tag: "meta",
|
|
2458
2442
|
attributes: {
|
|
2459
|
-
property:
|
|
2443
|
+
property: "og:image:height",
|
|
2460
2444
|
content: String(img.height)
|
|
2461
2445
|
}
|
|
2462
2446
|
});
|
|
@@ -2466,58 +2450,58 @@ function toNextHeadTags(resolved) {
|
|
|
2466
2450
|
if (resolved.twitter) {
|
|
2467
2451
|
const tw = resolved.twitter;
|
|
2468
2452
|
if (tw.card) tags.push({
|
|
2469
|
-
key:
|
|
2470
|
-
tag:
|
|
2453
|
+
key: "tw:card",
|
|
2454
|
+
tag: "meta",
|
|
2471
2455
|
attributes: {
|
|
2472
|
-
name:
|
|
2456
|
+
name: "twitter:card",
|
|
2473
2457
|
content: tw.card
|
|
2474
2458
|
}
|
|
2475
2459
|
});
|
|
2476
2460
|
if (tw.site) tags.push({
|
|
2477
|
-
key:
|
|
2478
|
-
tag:
|
|
2461
|
+
key: "tw:site",
|
|
2462
|
+
tag: "meta",
|
|
2479
2463
|
attributes: {
|
|
2480
|
-
name:
|
|
2464
|
+
name: "twitter:site",
|
|
2481
2465
|
content: tw.site
|
|
2482
2466
|
}
|
|
2483
2467
|
});
|
|
2484
2468
|
if (tw.creator) tags.push({
|
|
2485
|
-
key:
|
|
2486
|
-
tag:
|
|
2469
|
+
key: "tw:creator",
|
|
2470
|
+
tag: "meta",
|
|
2487
2471
|
attributes: {
|
|
2488
|
-
name:
|
|
2472
|
+
name: "twitter:creator",
|
|
2489
2473
|
content: tw.creator
|
|
2490
2474
|
}
|
|
2491
2475
|
});
|
|
2492
2476
|
if (tw.title) tags.push({
|
|
2493
|
-
key:
|
|
2494
|
-
tag:
|
|
2477
|
+
key: "tw:title",
|
|
2478
|
+
tag: "meta",
|
|
2495
2479
|
attributes: {
|
|
2496
|
-
name:
|
|
2480
|
+
name: "twitter:title",
|
|
2497
2481
|
content: tw.title
|
|
2498
2482
|
}
|
|
2499
2483
|
});
|
|
2500
2484
|
if (tw.description) tags.push({
|
|
2501
|
-
key:
|
|
2502
|
-
tag:
|
|
2485
|
+
key: "tw:desc",
|
|
2486
|
+
tag: "meta",
|
|
2503
2487
|
attributes: {
|
|
2504
|
-
name:
|
|
2488
|
+
name: "twitter:description",
|
|
2505
2489
|
content: tw.description
|
|
2506
2490
|
}
|
|
2507
2491
|
});
|
|
2508
2492
|
if (tw.image) tags.push({
|
|
2509
|
-
key:
|
|
2510
|
-
tag:
|
|
2493
|
+
key: "tw:img",
|
|
2494
|
+
tag: "meta",
|
|
2511
2495
|
attributes: {
|
|
2512
|
-
name:
|
|
2496
|
+
name: "twitter:image",
|
|
2513
2497
|
content: tw.image
|
|
2514
2498
|
}
|
|
2515
2499
|
});
|
|
2516
2500
|
if (tw.imageAlt) tags.push({
|
|
2517
|
-
key:
|
|
2518
|
-
tag:
|
|
2501
|
+
key: "tw:img:alt",
|
|
2502
|
+
tag: "meta",
|
|
2519
2503
|
attributes: {
|
|
2520
|
-
name:
|
|
2504
|
+
name: "twitter:image:alt",
|
|
2521
2505
|
content: tw.imageAlt
|
|
2522
2506
|
}
|
|
2523
2507
|
});
|
|
@@ -2527,9 +2511,9 @@ function toNextHeadTags(resolved) {
|
|
|
2527
2511
|
Object.entries(resolved.alternates.languages).forEach(([locale, url]) => {
|
|
2528
2512
|
tags.push({
|
|
2529
2513
|
key: `hreflang:${locale}`,
|
|
2530
|
-
tag:
|
|
2514
|
+
tag: "link",
|
|
2531
2515
|
attributes: {
|
|
2532
|
-
rel:
|
|
2516
|
+
rel: "alternate",
|
|
2533
2517
|
hreflang: locale,
|
|
2534
2518
|
href: url
|
|
2535
2519
|
}
|
|
@@ -2539,10 +2523,10 @@ function toNextHeadTags(resolved) {
|
|
|
2539
2523
|
// Manifest
|
|
2540
2524
|
if (resolved.manifest) {
|
|
2541
2525
|
tags.push({
|
|
2542
|
-
key:
|
|
2543
|
-
tag:
|
|
2526
|
+
key: "manifest",
|
|
2527
|
+
tag: "link",
|
|
2544
2528
|
attributes: {
|
|
2545
|
-
rel:
|
|
2529
|
+
rel: "manifest",
|
|
2546
2530
|
href: resolved.manifest
|
|
2547
2531
|
}
|
|
2548
2532
|
});
|
|
@@ -2553,7 +2537,7 @@ function toNextHeadTags(resolved) {
|
|
|
2553
2537
|
function normalizeOgImages(images, singleImage) {
|
|
2554
2538
|
if (images === null || images === void 0 ? void 0 : images.length) return images;
|
|
2555
2539
|
if (!singleImage) return [];
|
|
2556
|
-
return [typeof singleImage ===
|
|
2540
|
+
return [typeof singleImage === "string" ? {
|
|
2557
2541
|
url: singleImage
|
|
2558
2542
|
} : singleImage];
|
|
2559
2543
|
}/**
|
|
@@ -2872,23 +2856,23 @@ function generateLlmsTxt(config) {
|
|
|
2872
2856
|
const lines = [];
|
|
2873
2857
|
// Header
|
|
2874
2858
|
lines.push(`# ${config.siteName}`);
|
|
2875
|
-
lines.push(
|
|
2859
|
+
lines.push("");
|
|
2876
2860
|
// Description
|
|
2877
2861
|
if (config.siteDescription) {
|
|
2878
2862
|
lines.push(`> ${config.siteDescription}`);
|
|
2879
|
-
lines.push(
|
|
2863
|
+
lines.push("");
|
|
2880
2864
|
}
|
|
2881
2865
|
// Entries grouped under "Docs"
|
|
2882
2866
|
if (config.entries.length > 0) {
|
|
2883
|
-
lines.push(
|
|
2884
|
-
lines.push(
|
|
2867
|
+
lines.push("## Docs");
|
|
2868
|
+
lines.push("");
|
|
2885
2869
|
config.entries.forEach(entry => {
|
|
2886
|
-
const desc = entry.description ? `: ${entry.description}` :
|
|
2870
|
+
const desc = entry.description ? `: ${entry.description}` : "";
|
|
2887
2871
|
lines.push(`- [${entry.title}](${entry.url})${desc}`);
|
|
2888
2872
|
});
|
|
2889
|
-
lines.push(
|
|
2873
|
+
lines.push("");
|
|
2890
2874
|
}
|
|
2891
|
-
return lines.join(
|
|
2875
|
+
return lines.join("\n");
|
|
2892
2876
|
}
|
|
2893
2877
|
/**
|
|
2894
2878
|
* Generate a full markdown version (llms-full.txt) that includes
|
|
@@ -2900,29 +2884,29 @@ function generateLlmsTxt(config) {
|
|
|
2900
2884
|
function generateLlmsFullTxt(config, pageContents) {
|
|
2901
2885
|
const lines = [];
|
|
2902
2886
|
lines.push(`# ${config.siteName}`);
|
|
2903
|
-
lines.push(
|
|
2887
|
+
lines.push("");
|
|
2904
2888
|
if (config.siteDescription) {
|
|
2905
2889
|
lines.push(`> ${config.siteDescription}`);
|
|
2906
|
-
lines.push(
|
|
2890
|
+
lines.push("");
|
|
2907
2891
|
}
|
|
2908
2892
|
pageContents.forEach(({
|
|
2909
2893
|
entry,
|
|
2910
2894
|
markdown
|
|
2911
2895
|
}) => {
|
|
2912
2896
|
lines.push(`## ${entry.title}`);
|
|
2913
|
-
lines.push(
|
|
2897
|
+
lines.push("");
|
|
2914
2898
|
if (entry.description) {
|
|
2915
2899
|
lines.push(`> ${entry.description}`);
|
|
2916
|
-
lines.push(
|
|
2900
|
+
lines.push("");
|
|
2917
2901
|
}
|
|
2918
2902
|
lines.push(`Source: ${entry.url}`);
|
|
2919
|
-
lines.push(
|
|
2903
|
+
lines.push("");
|
|
2920
2904
|
lines.push(markdown);
|
|
2921
|
-
lines.push(
|
|
2922
|
-
lines.push(
|
|
2923
|
-
lines.push(
|
|
2905
|
+
lines.push("");
|
|
2906
|
+
lines.push("---");
|
|
2907
|
+
lines.push("");
|
|
2924
2908
|
});
|
|
2925
|
-
return lines.join(
|
|
2909
|
+
return lines.join("\n");
|
|
2926
2910
|
}
|
|
2927
2911
|
/**
|
|
2928
2912
|
* Helper to convert a ResolvedMetadata + page text into a clean markdown
|
|
@@ -2933,13 +2917,13 @@ function generateLlmsFullTxt(config, pageContents) {
|
|
|
2933
2917
|
function pageToMarkdown(options) {
|
|
2934
2918
|
const lines = [];
|
|
2935
2919
|
lines.push(`# ${options.title}`);
|
|
2936
|
-
lines.push(
|
|
2920
|
+
lines.push("");
|
|
2937
2921
|
if (options.description) {
|
|
2938
2922
|
lines.push(options.description);
|
|
2939
|
-
lines.push(
|
|
2923
|
+
lines.push("");
|
|
2940
2924
|
}
|
|
2941
2925
|
lines.push(`URL: ${options.url}`);
|
|
2942
|
-
lines.push(
|
|
2926
|
+
lines.push("");
|
|
2943
2927
|
lines.push(options.content);
|
|
2944
|
-
return lines.join(
|
|
2928
|
+
return lines.join("\n");
|
|
2945
2929
|
}export{MemoizationCache,MetadataStoreProvider,PageGenerator,RenderComponents,applyMetadataToDom,buildArticleJsonLd,buildBreadcrumbListJsonLd,buildFAQPageJsonLd,buildOrganizationJsonLd,buildProductJsonLd,buildWebSiteJsonLd,clearMetadataLog,collectMetadataToHtml,createMetadataStore,createScopePageVariablesAtom,deepEqual,generateLlmsFullTxt,generateLlmsTxt,generateRobotsTxt,generateSitemapEntries,generateSitemapXml,getMetadata,getMetadataLog,getPageConfig,getPageVariablesCompositeKey,isStableValue,logMetadata,memoPropsComparator,memoize,optimizeDeps,pageConfigAtom,pageToMarkdown,pageVariablesAtom,pageVariablesAtomFamily,resetMetadata,resolveMetadata,setMetadata,setMetadataLogging,shallowEqual,toNextHeadTags,toNextMetadata,useApplyMetadata,useFormData,useGenerateContent,useGenerateContentRender,useMetadata,useMetadataStore,usePageConfig,usePageConfigReset,usePageConfigState,usePageConfigValue,usePageUtiles,useViewSettings};//# sourceMappingURL=index.mjs.map
|