feat(blog): add file-based blog with dynamic slugs, MDX content and layout shell

- Introduced blog routing using Next.js App Router
- Implemented dynamic [slug] pages for blog posts
- Added MDX-based content loading via lib/posts
- Integrated shared TopBar layout with navigation
- Established clear content, lib and component separation
This commit is contained in:
PascalSchattenburg
2026-01-22 14:14:15 +01:00
parent b717952234
commit d147843c76
10412 changed files with 2475583 additions and 0 deletions

View File

@@ -0,0 +1,4 @@
import type { ResolvedMetadata } from '../types/metadata-interface';
export declare function AlternatesMetadata({ alternates, }: {
alternates: ResolvedMetadata['alternates'];
}): NonNullable<import("react/jsx-runtime").JSX.Element | (import("react/jsx-runtime").JSX.Element | null | undefined)[]>[] | null;

View File

@@ -0,0 +1,55 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "AlternatesMetadata", {
enumerable: true,
get: function() {
return AlternatesMetadata;
}
});
const _jsxruntime = require("react/jsx-runtime");
const _react = /*#__PURE__*/ _interop_require_default(require("react"));
const _meta = require("./meta");
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
function AlternateLink({ descriptor, ...props }) {
if (!descriptor.url) return null;
return /*#__PURE__*/ (0, _jsxruntime.jsx)("link", {
...props,
...descriptor.title && {
title: descriptor.title
},
href: descriptor.url.toString()
});
}
function AlternatesMetadata({ alternates }) {
if (!alternates) return null;
const { canonical, languages, media, types } = alternates;
return (0, _meta.MetaFilter)([
canonical ? AlternateLink({
rel: 'canonical',
descriptor: canonical
}) : null,
languages ? Object.entries(languages).flatMap(([locale, descriptors])=>descriptors == null ? void 0 : descriptors.map((descriptor)=>AlternateLink({
rel: 'alternate',
hrefLang: locale,
descriptor
}))) : null,
media ? Object.entries(media).flatMap(([mediaName, descriptors])=>descriptors == null ? void 0 : descriptors.map((descriptor)=>AlternateLink({
rel: 'alternate',
media: mediaName,
descriptor
}))) : null,
types ? Object.entries(types).flatMap(([type, descriptors])=>descriptors == null ? void 0 : descriptors.map((descriptor)=>AlternateLink({
rel: 'alternate',
type,
descriptor
}))) : null
]);
}
//# sourceMappingURL=alternate.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../src/lib/metadata/generate/alternate.tsx"],"sourcesContent":["import type { ResolvedMetadata } from '../types/metadata-interface'\nimport type { AlternateLinkDescriptor } from '../types/alternative-urls-types'\n\nimport React from 'react'\nimport { MetaFilter } from './meta'\n\nfunction AlternateLink({\n descriptor,\n ...props\n}: {\n descriptor: AlternateLinkDescriptor\n} & React.LinkHTMLAttributes<HTMLLinkElement>) {\n if (!descriptor.url) return null\n return (\n <link\n {...props}\n {...(descriptor.title && { title: descriptor.title })}\n href={descriptor.url.toString()}\n />\n )\n}\n\nexport function AlternatesMetadata({\n alternates,\n}: {\n alternates: ResolvedMetadata['alternates']\n}) {\n if (!alternates) return null\n\n const { canonical, languages, media, types } = alternates\n\n return MetaFilter([\n canonical\n ? AlternateLink({ rel: 'canonical', descriptor: canonical })\n : null,\n languages\n ? Object.entries(languages).flatMap(([locale, descriptors]) =>\n descriptors?.map((descriptor) =>\n AlternateLink({ rel: 'alternate', hrefLang: locale, descriptor })\n )\n )\n : null,\n media\n ? Object.entries(media).flatMap(([mediaName, descriptors]) =>\n descriptors?.map((descriptor) =>\n AlternateLink({ rel: 'alternate', media: mediaName, descriptor })\n )\n )\n : null,\n types\n ? Object.entries(types).flatMap(([type, descriptors]) =>\n descriptors?.map((descriptor) =>\n AlternateLink({ rel: 'alternate', type, descriptor })\n )\n )\n : null,\n ])\n}\n"],"names":["AlternatesMetadata","AlternateLink","descriptor","props","url","link","title","href","toString","alternates","canonical","languages","media","types","MetaFilter","rel","Object","entries","flatMap","locale","descriptors","map","hrefLang","mediaName","type"],"mappings":";;;;+BAsBgBA;;;eAAAA;;;;8DAnBE;sBACS;;;;;;AAE3B,SAASC,cAAc,EACrBC,UAAU,EACV,GAAGC,OAGwC;IAC3C,IAAI,CAACD,WAAWE,GAAG,EAAE,OAAO;IAC5B,qBACE,qBAACC;QACE,GAAGF,KAAK;QACR,GAAID,WAAWI,KAAK,IAAI;YAAEA,OAAOJ,WAAWI,KAAK;QAAC,CAAC;QACpDC,MAAML,WAAWE,GAAG,CAACI,QAAQ;;AAGnC;AAEO,SAASR,mBAAmB,EACjCS,UAAU,EAGX;IACC,IAAI,CAACA,YAAY,OAAO;IAExB,MAAM,EAAEC,SAAS,EAAEC,SAAS,EAAEC,KAAK,EAAEC,KAAK,EAAE,GAAGJ;IAE/C,OAAOK,IAAAA,gBAAU,EAAC;QAChBJ,YACIT,cAAc;YAAEc,KAAK;YAAab,YAAYQ;QAAU,KACxD;QACJC,YACIK,OAAOC,OAAO,CAACN,WAAWO,OAAO,CAAC,CAAC,CAACC,QAAQC,YAAY,GACtDA,+BAAAA,YAAaC,GAAG,CAAC,CAACnB,aAChBD,cAAc;oBAAEc,KAAK;oBAAaO,UAAUH;oBAAQjB;gBAAW,OAGnE;QACJU,QACII,OAAOC,OAAO,CAACL,OAAOM,OAAO,CAAC,CAAC,CAACK,WAAWH,YAAY,GACrDA,+BAAAA,YAAaC,GAAG,CAAC,CAACnB,aAChBD,cAAc;oBAAEc,KAAK;oBAAaH,OAAOW;oBAAWrB;gBAAW,OAGnE;QACJW,QACIG,OAAOC,OAAO,CAACJ,OAAOK,OAAO,CAAC,CAAC,CAACM,MAAMJ,YAAY,GAChDA,+BAAAA,YAAaC,GAAG,CAAC,CAACnB,aAChBD,cAAc;oBAAEc,KAAK;oBAAaS;oBAAMtB;gBAAW,OAGvD;KACL;AACH","ignoreList":[0]}

View File

@@ -0,0 +1,25 @@
import type { ResolvedMetadata, ResolvedViewport } from '../types/metadata-interface';
export declare function ViewportMeta({ viewport }: {
viewport: ResolvedViewport;
}): import("react/jsx-runtime").JSX.Element[];
export declare function BasicMeta({ metadata }: {
metadata: ResolvedMetadata;
}): NonNullable<import("react/jsx-runtime").JSX.Element | (import("react/jsx-runtime").JSX.Element | null)[]>[];
export declare function ItunesMeta({ itunes }: {
itunes: ResolvedMetadata['itunes'];
}): import("react/jsx-runtime").JSX.Element | null;
export declare function FacebookMeta({ facebook, }: {
facebook: ResolvedMetadata['facebook'];
}): import("react/jsx-runtime").JSX.Element[] | null;
export declare function PinterestMeta({ pinterest, }: {
pinterest: ResolvedMetadata['pinterest'];
}): import("react/jsx-runtime").JSX.Element | null;
export declare function FormatDetectionMeta({ formatDetection, }: {
formatDetection: ResolvedMetadata['formatDetection'];
}): import("react/jsx-runtime").JSX.Element | null;
export declare function AppleWebAppMeta({ appleWebApp, }: {
appleWebApp: ResolvedMetadata['appleWebApp'];
}): NonNullable<import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | import("react/jsx-runtime").JSX.Element[]>[] | null;
export declare function VerificationMeta({ verification, }: {
verification: ResolvedMetadata['verification'];
}): NonNullable<import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>[]>[][] | null;

View File

@@ -0,0 +1,307 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
AppleWebAppMeta: null,
BasicMeta: null,
FacebookMeta: null,
FormatDetectionMeta: null,
ItunesMeta: null,
PinterestMeta: null,
VerificationMeta: null,
ViewportMeta: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
AppleWebAppMeta: function() {
return AppleWebAppMeta;
},
BasicMeta: function() {
return BasicMeta;
},
FacebookMeta: function() {
return FacebookMeta;
},
FormatDetectionMeta: function() {
return FormatDetectionMeta;
},
ItunesMeta: function() {
return ItunesMeta;
},
PinterestMeta: function() {
return PinterestMeta;
},
VerificationMeta: function() {
return VerificationMeta;
},
ViewportMeta: function() {
return ViewportMeta;
}
});
const _jsxruntime = require("react/jsx-runtime");
const _meta = require("./meta");
const _constants = require("../constants");
const _utils = require("./utils");
// convert viewport object to string for viewport meta tag
function resolveViewportLayout(viewport) {
let resolved = null;
if (viewport && typeof viewport === 'object') {
resolved = '';
for(const viewportKey_ in _constants.ViewportMetaKeys){
const viewportKey = viewportKey_;
if (viewportKey in viewport) {
let value = viewport[viewportKey];
if (typeof value === 'boolean') {
value = value ? 'yes' : 'no';
} else if (!value && viewportKey === 'initialScale') {
value = undefined;
}
if (value) {
if (resolved) resolved += ', ';
resolved += `${_constants.ViewportMetaKeys[viewportKey]}=${value}`;
}
}
}
}
return resolved;
}
function ViewportMeta({ viewport }) {
return (0, _meta.MetaFilter)([
/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", {
charSet: "utf-8"
}),
(0, _meta.Meta)({
name: 'viewport',
content: resolveViewportLayout(viewport)
}),
...viewport.themeColor ? viewport.themeColor.map((themeColor)=>(0, _meta.Meta)({
name: 'theme-color',
content: themeColor.color,
media: themeColor.media
})) : [],
(0, _meta.Meta)({
name: 'color-scheme',
content: viewport.colorScheme
})
]);
}
function BasicMeta({ metadata }) {
var _metadata_keywords, _metadata_robots, _metadata_robots1;
const manifestOrigin = metadata.manifest ? (0, _utils.getOrigin)(metadata.manifest) : undefined;
return (0, _meta.MetaFilter)([
metadata.title !== null && metadata.title.absolute ? /*#__PURE__*/ (0, _jsxruntime.jsx)("title", {
children: metadata.title.absolute
}) : null,
(0, _meta.Meta)({
name: 'description',
content: metadata.description
}),
(0, _meta.Meta)({
name: 'application-name',
content: metadata.applicationName
}),
...metadata.authors ? metadata.authors.map((author)=>[
author.url ? /*#__PURE__*/ (0, _jsxruntime.jsx)("link", {
rel: "author",
href: author.url.toString()
}) : null,
(0, _meta.Meta)({
name: 'author',
content: author.name
})
]) : [],
metadata.manifest ? /*#__PURE__*/ (0, _jsxruntime.jsx)("link", {
rel: "manifest",
href: metadata.manifest.toString(),
// If it's same origin, and it's a preview deployment,
// including credentials for manifest request.
crossOrigin: !manifestOrigin && process.env.VERCEL_ENV === 'preview' ? 'use-credentials' : undefined
}) : null,
(0, _meta.Meta)({
name: 'generator',
content: metadata.generator
}),
(0, _meta.Meta)({
name: 'keywords',
content: (_metadata_keywords = metadata.keywords) == null ? void 0 : _metadata_keywords.join(',')
}),
(0, _meta.Meta)({
name: 'referrer',
content: metadata.referrer
}),
(0, _meta.Meta)({
name: 'creator',
content: metadata.creator
}),
(0, _meta.Meta)({
name: 'publisher',
content: metadata.publisher
}),
(0, _meta.Meta)({
name: 'robots',
content: (_metadata_robots = metadata.robots) == null ? void 0 : _metadata_robots.basic
}),
(0, _meta.Meta)({
name: 'googlebot',
content: (_metadata_robots1 = metadata.robots) == null ? void 0 : _metadata_robots1.googleBot
}),
(0, _meta.Meta)({
name: 'abstract',
content: metadata.abstract
}),
...metadata.archives ? metadata.archives.map((archive)=>/*#__PURE__*/ (0, _jsxruntime.jsx)("link", {
rel: "archives",
href: archive
})) : [],
...metadata.assets ? metadata.assets.map((asset)=>/*#__PURE__*/ (0, _jsxruntime.jsx)("link", {
rel: "assets",
href: asset
})) : [],
...metadata.bookmarks ? metadata.bookmarks.map((bookmark)=>/*#__PURE__*/ (0, _jsxruntime.jsx)("link", {
rel: "bookmarks",
href: bookmark
})) : [],
...metadata.pagination ? [
metadata.pagination.previous ? /*#__PURE__*/ (0, _jsxruntime.jsx)("link", {
rel: "prev",
href: metadata.pagination.previous
}) : null,
metadata.pagination.next ? /*#__PURE__*/ (0, _jsxruntime.jsx)("link", {
rel: "next",
href: metadata.pagination.next
}) : null
] : [],
(0, _meta.Meta)({
name: 'category',
content: metadata.category
}),
(0, _meta.Meta)({
name: 'classification',
content: metadata.classification
}),
...metadata.other ? Object.entries(metadata.other).map(([name, content])=>{
if (Array.isArray(content)) {
return content.map((contentItem)=>(0, _meta.Meta)({
name,
content: contentItem
}));
} else {
return (0, _meta.Meta)({
name,
content
});
}
}) : []
]);
}
function ItunesMeta({ itunes }) {
if (!itunes) return null;
const { appId, appArgument } = itunes;
let content = `app-id=${appId}`;
if (appArgument) {
content += `, app-argument=${appArgument}`;
}
return /*#__PURE__*/ (0, _jsxruntime.jsx)("meta", {
name: "apple-itunes-app",
content: content
});
}
function FacebookMeta({ facebook }) {
if (!facebook) return null;
const { appId, admins } = facebook;
return (0, _meta.MetaFilter)([
appId ? /*#__PURE__*/ (0, _jsxruntime.jsx)("meta", {
property: "fb:app_id",
content: appId
}) : null,
...admins ? admins.map((admin)=>/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", {
property: "fb:admins",
content: admin
})) : []
]);
}
function PinterestMeta({ pinterest }) {
if (!pinterest || pinterest.richPin === undefined) return null;
const { richPin } = pinterest;
return /*#__PURE__*/ (0, _jsxruntime.jsx)("meta", {
property: "pinterest-rich-pin",
content: richPin.toString()
});
}
const formatDetectionKeys = [
'telephone',
'date',
'address',
'email',
'url'
];
function FormatDetectionMeta({ formatDetection }) {
if (!formatDetection) return null;
let content = '';
for (const key of formatDetectionKeys){
if (formatDetection[key] === false) {
if (content) content += ', ';
content += `${key}=no`;
}
}
return content ? /*#__PURE__*/ (0, _jsxruntime.jsx)("meta", {
name: "format-detection",
content: content
}) : null;
}
function AppleWebAppMeta({ appleWebApp }) {
if (!appleWebApp) return null;
const { capable, title, startupImage, statusBarStyle } = appleWebApp;
return (0, _meta.MetaFilter)([
capable ? (0, _meta.Meta)({
name: 'mobile-web-app-capable',
content: 'yes'
}) : null,
(0, _meta.Meta)({
name: 'apple-mobile-web-app-title',
content: title
}),
startupImage ? startupImage.map((image)=>/*#__PURE__*/ (0, _jsxruntime.jsx)("link", {
href: image.url,
media: image.media,
rel: "apple-touch-startup-image"
})) : null,
statusBarStyle ? (0, _meta.Meta)({
name: 'apple-mobile-web-app-status-bar-style',
content: statusBarStyle
}) : null
]);
}
function VerificationMeta({ verification }) {
if (!verification) return null;
return (0, _meta.MetaFilter)([
(0, _meta.MultiMeta)({
namePrefix: 'google-site-verification',
contents: verification.google
}),
(0, _meta.MultiMeta)({
namePrefix: 'y_key',
contents: verification.yahoo
}),
(0, _meta.MultiMeta)({
namePrefix: 'yandex-verification',
contents: verification.yandex
}),
(0, _meta.MultiMeta)({
namePrefix: 'me',
contents: verification.me
}),
...verification.other ? Object.entries(verification.other).map(([key, value])=>(0, _meta.MultiMeta)({
namePrefix: key,
contents: value
})) : []
]);
}
//# sourceMappingURL=basic.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
export declare const IconMark: () => import("react/jsx-runtime").JSX.Element | null;

View File

@@ -0,0 +1,22 @@
'use client';
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "IconMark", {
enumerable: true,
get: function() {
return IconMark;
}
});
const _jsxruntime = require("react/jsx-runtime");
const IconMark = ()=>{
if (typeof window !== 'undefined') {
return null;
}
return /*#__PURE__*/ (0, _jsxruntime.jsx)("meta", {
name: "\xabnxt-icon\xbb"
});
};
//# sourceMappingURL=icon-mark.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../src/lib/metadata/generate/icon-mark.tsx"],"sourcesContent":["'use client'\n\n// This is a client component that only renders during SSR,\n// but will be replaced during streaming with an icon insertion script tag.\n// We don't want it to be presented anywhere so it's only visible during streaming,\n// right after the icon meta tags so that browser can pick it up as soon as it's rendered.\n// Note: we don't just emit the script here because we only need the script if it's not in the head,\n// and we need it to be hoistable alongside the other metadata but sync scripts are not hoistable.\nexport const IconMark = () => {\n if (typeof window !== 'undefined') {\n return null\n }\n return <meta name=\"«nxt-icon»\" />\n}\n"],"names":["IconMark","window","meta","name"],"mappings":"AAAA;;;;;+BAQaA;;;eAAAA;;;;AAAN,MAAMA,WAAW;IACtB,IAAI,OAAOC,WAAW,aAAa;QACjC,OAAO;IACT;IACA,qBAAO,qBAACC;QAAKC,MAAK;;AACpB","ignoreList":[0]}

View File

@@ -0,0 +1,4 @@
import type { ResolvedMetadata } from '../types/metadata-interface';
export declare function IconsMetadata({ icons }: {
icons: ResolvedMetadata['icons'];
}): NonNullable<import("react/jsx-runtime").JSX.Element | import("react/jsx-runtime").JSX.Element[]>[] | null;

View File

@@ -0,0 +1,64 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "IconsMetadata", {
enumerable: true,
get: function() {
return IconsMetadata;
}
});
const _jsxruntime = require("react/jsx-runtime");
const _iconmark = require("./icon-mark");
const _meta = require("./meta");
function IconDescriptorLink({ icon }) {
const { url, rel = 'icon', ...props } = icon;
return /*#__PURE__*/ (0, _jsxruntime.jsx)("link", {
rel: rel,
href: url.toString(),
...props
});
}
function IconLink({ rel, icon }) {
if (typeof icon === 'object' && !(icon instanceof URL)) {
if (!icon.rel && rel) icon.rel = rel;
return IconDescriptorLink({
icon
});
} else {
const href = icon.toString();
return /*#__PURE__*/ (0, _jsxruntime.jsx)("link", {
rel: rel,
href: href
});
}
}
function IconsMetadata({ icons }) {
if (!icons) return null;
const shortcutList = icons.shortcut;
const iconList = icons.icon;
const appleList = icons.apple;
const otherList = icons.other;
const hasIcon = Boolean((shortcutList == null ? void 0 : shortcutList.length) || (iconList == null ? void 0 : iconList.length) || (appleList == null ? void 0 : appleList.length) || (otherList == null ? void 0 : otherList.length));
if (!hasIcon) return null;
return (0, _meta.MetaFilter)([
shortcutList ? shortcutList.map((icon)=>IconLink({
rel: 'shortcut icon',
icon
})) : null,
iconList ? iconList.map((icon)=>IconLink({
rel: 'icon',
icon
})) : null,
appleList ? appleList.map((icon)=>IconLink({
rel: 'apple-touch-icon',
icon
})) : null,
otherList ? otherList.map((icon)=>IconDescriptorLink({
icon
})) : null,
hasIcon ? /*#__PURE__*/ (0, _jsxruntime.jsx)(_iconmark.IconMark, {}) : null
]);
}
//# sourceMappingURL=icons.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../src/lib/metadata/generate/icons.tsx"],"sourcesContent":["import type { ResolvedMetadata } from '../types/metadata-interface'\nimport type { Icon, IconDescriptor } from '../types/metadata-types'\nimport { IconMark } from './icon-mark'\n\nimport { MetaFilter } from './meta'\n\nfunction IconDescriptorLink({ icon }: { icon: IconDescriptor }) {\n const { url, rel = 'icon', ...props } = icon\n\n return <link rel={rel} href={url.toString()} {...props} />\n}\n\nfunction IconLink({ rel, icon }: { rel?: string; icon: Icon }) {\n if (typeof icon === 'object' && !(icon instanceof URL)) {\n if (!icon.rel && rel) icon.rel = rel\n return IconDescriptorLink({ icon })\n } else {\n const href = icon.toString()\n return <link rel={rel} href={href} />\n }\n}\n\nexport function IconsMetadata({ icons }: { icons: ResolvedMetadata['icons'] }) {\n if (!icons) return null\n\n const shortcutList = icons.shortcut\n const iconList = icons.icon\n const appleList = icons.apple\n const otherList = icons.other\n\n const hasIcon = Boolean(\n shortcutList?.length ||\n iconList?.length ||\n appleList?.length ||\n otherList?.length\n )\n if (!hasIcon) return null\n\n return MetaFilter([\n shortcutList\n ? shortcutList.map((icon) => IconLink({ rel: 'shortcut icon', icon }))\n : null,\n iconList ? iconList.map((icon) => IconLink({ rel: 'icon', icon })) : null,\n appleList\n ? appleList.map((icon) => IconLink({ rel: 'apple-touch-icon', icon }))\n : null,\n otherList ? otherList.map((icon) => IconDescriptorLink({ icon })) : null,\n hasIcon ? <IconMark /> : null,\n ])\n}\n"],"names":["IconsMetadata","IconDescriptorLink","icon","url","rel","props","link","href","toString","IconLink","URL","icons","shortcutList","shortcut","iconList","appleList","apple","otherList","other","hasIcon","Boolean","length","MetaFilter","map","IconMark"],"mappings":";;;;+BAsBgBA;;;eAAAA;;;;0BApBS;sBAEE;AAE3B,SAASC,mBAAmB,EAAEC,IAAI,EAA4B;IAC5D,MAAM,EAAEC,GAAG,EAAEC,MAAM,MAAM,EAAE,GAAGC,OAAO,GAAGH;IAExC,qBAAO,qBAACI;QAAKF,KAAKA;QAAKG,MAAMJ,IAAIK,QAAQ;QAAK,GAAGH,KAAK;;AACxD;AAEA,SAASI,SAAS,EAAEL,GAAG,EAAEF,IAAI,EAAgC;IAC3D,IAAI,OAAOA,SAAS,YAAY,CAAEA,CAAAA,gBAAgBQ,GAAE,GAAI;QACtD,IAAI,CAACR,KAAKE,GAAG,IAAIA,KAAKF,KAAKE,GAAG,GAAGA;QACjC,OAAOH,mBAAmB;YAAEC;QAAK;IACnC,OAAO;QACL,MAAMK,OAAOL,KAAKM,QAAQ;QAC1B,qBAAO,qBAACF;YAAKF,KAAKA;YAAKG,MAAMA;;IAC/B;AACF;AAEO,SAASP,cAAc,EAAEW,KAAK,EAAwC;IAC3E,IAAI,CAACA,OAAO,OAAO;IAEnB,MAAMC,eAAeD,MAAME,QAAQ;IACnC,MAAMC,WAAWH,MAAMT,IAAI;IAC3B,MAAMa,YAAYJ,MAAMK,KAAK;IAC7B,MAAMC,YAAYN,MAAMO,KAAK;IAE7B,MAAMC,UAAUC,QACdR,CAAAA,gCAAAA,aAAcS,MAAM,MAClBP,4BAAAA,SAAUO,MAAM,MAChBN,6BAAAA,UAAWM,MAAM,MACjBJ,6BAAAA,UAAWI,MAAM;IAErB,IAAI,CAACF,SAAS,OAAO;IAErB,OAAOG,IAAAA,gBAAU,EAAC;QAChBV,eACIA,aAAaW,GAAG,CAAC,CAACrB,OAASO,SAAS;gBAAEL,KAAK;gBAAiBF;YAAK,MACjE;QACJY,WAAWA,SAASS,GAAG,CAAC,CAACrB,OAASO,SAAS;gBAAEL,KAAK;gBAAQF;YAAK,MAAM;QACrEa,YACIA,UAAUQ,GAAG,CAAC,CAACrB,OAASO,SAAS;gBAAEL,KAAK;gBAAoBF;YAAK,MACjE;QACJe,YAAYA,UAAUM,GAAG,CAAC,CAACrB,OAASD,mBAAmB;gBAAEC;YAAK,MAAM;QACpEiB,wBAAU,qBAACK,kBAAQ,QAAM;KAC1B;AACH","ignoreList":[0]}

View File

@@ -0,0 +1,16 @@
import React from 'react';
export declare function Meta({ name, property, content, media, }: {
name?: string;
property?: string;
media?: string;
content: string | number | URL | null | undefined;
}): React.ReactElement | null;
export declare function MetaFilter<T extends {} | {}[]>(items: (T | null)[]): NonNullable<T>[];
type ExtendMetaContent = Record<string, undefined | string | URL | number | boolean | null | undefined>;
type MultiMetaContent = (ExtendMetaContent | string | URL | number)[] | null | undefined;
export declare function MultiMeta({ propertyPrefix, namePrefix, contents, }: {
propertyPrefix?: string;
namePrefix?: string;
contents?: MultiMetaContent | null;
}): NonNullable<React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | React.ReactElement<unknown, string | React.JSXElementConstructor<any>>[]>[] | null;
export {};

View File

@@ -0,0 +1,123 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
Meta: null,
MetaFilter: null,
MultiMeta: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
Meta: function() {
return Meta;
},
MetaFilter: function() {
return MetaFilter;
},
MultiMeta: function() {
return MultiMeta;
}
});
const _jsxruntime = require("react/jsx-runtime");
const _react = /*#__PURE__*/ _interop_require_default(require("react"));
const _nonnullable = require("../../non-nullable");
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
function Meta({ name, property, content, media }) {
if (typeof content !== 'undefined' && content !== null && content !== '') {
return /*#__PURE__*/ (0, _jsxruntime.jsx)("meta", {
...name ? {
name
} : {
property
},
...media ? {
media
} : undefined,
content: typeof content === 'string' ? content : content.toString()
});
}
return null;
}
function MetaFilter(items) {
const acc = [];
for (const item of items){
if (Array.isArray(item)) {
acc.push(...item.filter(_nonnullable.nonNullable));
} else if ((0, _nonnullable.nonNullable)(item)) {
acc.push(item);
}
}
return acc;
}
function camelToSnake(camelCaseStr) {
return camelCaseStr.replace(/([A-Z])/g, function(match) {
return '_' + match.toLowerCase();
});
}
const aliasPropPrefixes = new Set([
'og:image',
'twitter:image',
'og:video',
'og:audio'
]);
function getMetaKey(prefix, key) {
// Use `twitter:image` and `og:image` instead of `twitter:image:url` and `og:image:url`
// to be more compatible as it's a more common format.
// `og:video` & `og:audio` do not have a `:url` suffix alias
if (aliasPropPrefixes.has(prefix) && key === 'url') {
return prefix;
}
if (prefix.startsWith('og:') || prefix.startsWith('twitter:')) {
key = camelToSnake(key);
}
return prefix + ':' + key;
}
function ExtendMeta({ content, namePrefix, propertyPrefix }) {
if (!content) return null;
return MetaFilter(Object.entries(content).map(([k, v])=>{
return typeof v === 'undefined' ? null : Meta({
...propertyPrefix && {
property: getMetaKey(propertyPrefix, k)
},
...namePrefix && {
name: getMetaKey(namePrefix, k)
},
content: typeof v === 'string' ? v : v == null ? void 0 : v.toString()
});
}));
}
function MultiMeta({ propertyPrefix, namePrefix, contents }) {
if (typeof contents === 'undefined' || contents === null) {
return null;
}
return MetaFilter(contents.map((content)=>{
if (typeof content === 'string' || typeof content === 'number' || content instanceof URL) {
return Meta({
...propertyPrefix ? {
property: propertyPrefix
} : {
name: namePrefix
},
content
});
} else {
return ExtendMeta({
namePrefix,
propertyPrefix,
content
});
}
}));
}
//# sourceMappingURL=meta.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,10 @@
import type { ResolvedMetadata } from '../types/metadata-interface';
export declare function OpenGraphMetadata({ openGraph, }: {
openGraph: ResolvedMetadata['openGraph'];
}): NonNullable<import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | NonNullable<import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>[]>[]>[] | null;
export declare function TwitterMetadata({ twitter, }: {
twitter: ResolvedMetadata['twitter'];
}): NonNullable<import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | (import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | null)[] | NonNullable<import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>[]>[]>[] | null;
export declare function AppLinksMeta({ appLinks, }: {
appLinks: ResolvedMetadata['appLinks'];
}): NonNullable<import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>[]>[][] | null;

View File

@@ -0,0 +1,478 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
AppLinksMeta: null,
OpenGraphMetadata: null,
TwitterMetadata: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
AppLinksMeta: function() {
return AppLinksMeta;
},
OpenGraphMetadata: function() {
return OpenGraphMetadata;
},
TwitterMetadata: function() {
return TwitterMetadata;
}
});
const _meta = require("./meta");
function OpenGraphMetadata({ openGraph }) {
var _openGraph_title, _openGraph_url, _openGraph_ttl;
if (!openGraph) {
return null;
}
let typedOpenGraph;
if ('type' in openGraph) {
const openGraphType = openGraph.type;
switch(openGraphType){
case 'website':
typedOpenGraph = [
(0, _meta.Meta)({
property: 'og:type',
content: 'website'
})
];
break;
case 'article':
var _openGraph_publishedTime, _openGraph_modifiedTime, _openGraph_expirationTime;
typedOpenGraph = [
(0, _meta.Meta)({
property: 'og:type',
content: 'article'
}),
(0, _meta.Meta)({
property: 'article:published_time',
content: (_openGraph_publishedTime = openGraph.publishedTime) == null ? void 0 : _openGraph_publishedTime.toString()
}),
(0, _meta.Meta)({
property: 'article:modified_time',
content: (_openGraph_modifiedTime = openGraph.modifiedTime) == null ? void 0 : _openGraph_modifiedTime.toString()
}),
(0, _meta.Meta)({
property: 'article:expiration_time',
content: (_openGraph_expirationTime = openGraph.expirationTime) == null ? void 0 : _openGraph_expirationTime.toString()
}),
(0, _meta.MultiMeta)({
propertyPrefix: 'article:author',
contents: openGraph.authors
}),
(0, _meta.Meta)({
property: 'article:section',
content: openGraph.section
}),
(0, _meta.MultiMeta)({
propertyPrefix: 'article:tag',
contents: openGraph.tags
})
];
break;
case 'book':
typedOpenGraph = [
(0, _meta.Meta)({
property: 'og:type',
content: 'book'
}),
(0, _meta.Meta)({
property: 'book:isbn',
content: openGraph.isbn
}),
(0, _meta.Meta)({
property: 'book:release_date',
content: openGraph.releaseDate
}),
(0, _meta.MultiMeta)({
propertyPrefix: 'book:author',
contents: openGraph.authors
}),
(0, _meta.MultiMeta)({
propertyPrefix: 'book:tag',
contents: openGraph.tags
})
];
break;
case 'profile':
typedOpenGraph = [
(0, _meta.Meta)({
property: 'og:type',
content: 'profile'
}),
(0, _meta.Meta)({
property: 'profile:first_name',
content: openGraph.firstName
}),
(0, _meta.Meta)({
property: 'profile:last_name',
content: openGraph.lastName
}),
(0, _meta.Meta)({
property: 'profile:username',
content: openGraph.username
}),
(0, _meta.Meta)({
property: 'profile:gender',
content: openGraph.gender
})
];
break;
case 'music.song':
var _openGraph_duration;
typedOpenGraph = [
(0, _meta.Meta)({
property: 'og:type',
content: 'music.song'
}),
(0, _meta.Meta)({
property: 'music:duration',
content: (_openGraph_duration = openGraph.duration) == null ? void 0 : _openGraph_duration.toString()
}),
(0, _meta.MultiMeta)({
propertyPrefix: 'music:album',
contents: openGraph.albums
}),
(0, _meta.MultiMeta)({
propertyPrefix: 'music:musician',
contents: openGraph.musicians
})
];
break;
case 'music.album':
typedOpenGraph = [
(0, _meta.Meta)({
property: 'og:type',
content: 'music.album'
}),
(0, _meta.MultiMeta)({
propertyPrefix: 'music:song',
contents: openGraph.songs
}),
(0, _meta.MultiMeta)({
propertyPrefix: 'music:musician',
contents: openGraph.musicians
}),
(0, _meta.Meta)({
property: 'music:release_date',
content: openGraph.releaseDate
})
];
break;
case 'music.playlist':
typedOpenGraph = [
(0, _meta.Meta)({
property: 'og:type',
content: 'music.playlist'
}),
(0, _meta.MultiMeta)({
propertyPrefix: 'music:song',
contents: openGraph.songs
}),
(0, _meta.MultiMeta)({
propertyPrefix: 'music:creator',
contents: openGraph.creators
})
];
break;
case 'music.radio_station':
typedOpenGraph = [
(0, _meta.Meta)({
property: 'og:type',
content: 'music.radio_station'
}),
(0, _meta.MultiMeta)({
propertyPrefix: 'music:creator',
contents: openGraph.creators
})
];
break;
case 'video.movie':
typedOpenGraph = [
(0, _meta.Meta)({
property: 'og:type',
content: 'video.movie'
}),
(0, _meta.MultiMeta)({
propertyPrefix: 'video:actor',
contents: openGraph.actors
}),
(0, _meta.MultiMeta)({
propertyPrefix: 'video:director',
contents: openGraph.directors
}),
(0, _meta.MultiMeta)({
propertyPrefix: 'video:writer',
contents: openGraph.writers
}),
(0, _meta.Meta)({
property: 'video:duration',
content: openGraph.duration
}),
(0, _meta.Meta)({
property: 'video:release_date',
content: openGraph.releaseDate
}),
(0, _meta.MultiMeta)({
propertyPrefix: 'video:tag',
contents: openGraph.tags
})
];
break;
case 'video.episode':
typedOpenGraph = [
(0, _meta.Meta)({
property: 'og:type',
content: 'video.episode'
}),
(0, _meta.MultiMeta)({
propertyPrefix: 'video:actor',
contents: openGraph.actors
}),
(0, _meta.MultiMeta)({
propertyPrefix: 'video:director',
contents: openGraph.directors
}),
(0, _meta.MultiMeta)({
propertyPrefix: 'video:writer',
contents: openGraph.writers
}),
(0, _meta.Meta)({
property: 'video:duration',
content: openGraph.duration
}),
(0, _meta.Meta)({
property: 'video:release_date',
content: openGraph.releaseDate
}),
(0, _meta.MultiMeta)({
propertyPrefix: 'video:tag',
contents: openGraph.tags
}),
(0, _meta.Meta)({
property: 'video:series',
content: openGraph.series
})
];
break;
case 'video.tv_show':
typedOpenGraph = [
(0, _meta.Meta)({
property: 'og:type',
content: 'video.tv_show'
})
];
break;
case 'video.other':
typedOpenGraph = [
(0, _meta.Meta)({
property: 'og:type',
content: 'video.other'
})
];
break;
default:
const _exhaustiveCheck = openGraphType;
throw Object.defineProperty(new Error(`Invalid OpenGraph type: ${_exhaustiveCheck}`), "__NEXT_ERROR_CODE", {
value: "E237",
enumerable: false,
configurable: true
});
}
}
return (0, _meta.MetaFilter)([
(0, _meta.Meta)({
property: 'og:determiner',
content: openGraph.determiner
}),
(0, _meta.Meta)({
property: 'og:title',
content: (_openGraph_title = openGraph.title) == null ? void 0 : _openGraph_title.absolute
}),
(0, _meta.Meta)({
property: 'og:description',
content: openGraph.description
}),
(0, _meta.Meta)({
property: 'og:url',
content: (_openGraph_url = openGraph.url) == null ? void 0 : _openGraph_url.toString()
}),
(0, _meta.Meta)({
property: 'og:site_name',
content: openGraph.siteName
}),
(0, _meta.Meta)({
property: 'og:locale',
content: openGraph.locale
}),
(0, _meta.Meta)({
property: 'og:country_name',
content: openGraph.countryName
}),
(0, _meta.Meta)({
property: 'og:ttl',
content: (_openGraph_ttl = openGraph.ttl) == null ? void 0 : _openGraph_ttl.toString()
}),
(0, _meta.MultiMeta)({
propertyPrefix: 'og:image',
contents: openGraph.images
}),
(0, _meta.MultiMeta)({
propertyPrefix: 'og:video',
contents: openGraph.videos
}),
(0, _meta.MultiMeta)({
propertyPrefix: 'og:audio',
contents: openGraph.audio
}),
(0, _meta.MultiMeta)({
propertyPrefix: 'og:email',
contents: openGraph.emails
}),
(0, _meta.MultiMeta)({
propertyPrefix: 'og:phone_number',
contents: openGraph.phoneNumbers
}),
(0, _meta.MultiMeta)({
propertyPrefix: 'og:fax_number',
contents: openGraph.faxNumbers
}),
(0, _meta.MultiMeta)({
propertyPrefix: 'og:locale:alternate',
contents: openGraph.alternateLocale
}),
...typedOpenGraph ? typedOpenGraph : []
]);
}
function TwitterAppItem({ app, type }) {
var _app_url_type, _app_url;
return [
(0, _meta.Meta)({
name: `twitter:app:name:${type}`,
content: app.name
}),
(0, _meta.Meta)({
name: `twitter:app:id:${type}`,
content: app.id[type]
}),
(0, _meta.Meta)({
name: `twitter:app:url:${type}`,
content: (_app_url = app.url) == null ? void 0 : (_app_url_type = _app_url[type]) == null ? void 0 : _app_url_type.toString()
})
];
}
function TwitterMetadata({ twitter }) {
var _twitter_title;
if (!twitter) return null;
const { card } = twitter;
return (0, _meta.MetaFilter)([
(0, _meta.Meta)({
name: 'twitter:card',
content: card
}),
(0, _meta.Meta)({
name: 'twitter:site',
content: twitter.site
}),
(0, _meta.Meta)({
name: 'twitter:site:id',
content: twitter.siteId
}),
(0, _meta.Meta)({
name: 'twitter:creator',
content: twitter.creator
}),
(0, _meta.Meta)({
name: 'twitter:creator:id',
content: twitter.creatorId
}),
(0, _meta.Meta)({
name: 'twitter:title',
content: (_twitter_title = twitter.title) == null ? void 0 : _twitter_title.absolute
}),
(0, _meta.Meta)({
name: 'twitter:description',
content: twitter.description
}),
(0, _meta.MultiMeta)({
namePrefix: 'twitter:image',
contents: twitter.images
}),
...card === 'player' ? twitter.players.flatMap((player)=>[
(0, _meta.Meta)({
name: 'twitter:player',
content: player.playerUrl.toString()
}),
(0, _meta.Meta)({
name: 'twitter:player:stream',
content: player.streamUrl.toString()
}),
(0, _meta.Meta)({
name: 'twitter:player:width',
content: player.width
}),
(0, _meta.Meta)({
name: 'twitter:player:height',
content: player.height
})
]) : [],
...card === 'app' ? [
TwitterAppItem({
app: twitter.app,
type: 'iphone'
}),
TwitterAppItem({
app: twitter.app,
type: 'ipad'
}),
TwitterAppItem({
app: twitter.app,
type: 'googleplay'
})
] : []
]);
}
function AppLinksMeta({ appLinks }) {
if (!appLinks) return null;
return (0, _meta.MetaFilter)([
(0, _meta.MultiMeta)({
propertyPrefix: 'al:ios',
contents: appLinks.ios
}),
(0, _meta.MultiMeta)({
propertyPrefix: 'al:iphone',
contents: appLinks.iphone
}),
(0, _meta.MultiMeta)({
propertyPrefix: 'al:ipad',
contents: appLinks.ipad
}),
(0, _meta.MultiMeta)({
propertyPrefix: 'al:android',
contents: appLinks.android
}),
(0, _meta.MultiMeta)({
propertyPrefix: 'al:windows_phone',
contents: appLinks.windows_phone
}),
(0, _meta.MultiMeta)({
propertyPrefix: 'al:windows',
contents: appLinks.windows
}),
(0, _meta.MultiMeta)({
propertyPrefix: 'al:windows_universal',
contents: appLinks.windows_universal
}),
(0, _meta.MultiMeta)({
propertyPrefix: 'al:web',
contents: appLinks.web
})
]);
}
//# sourceMappingURL=opengraph.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,4 @@
declare function resolveArray<T>(value: T | T[]): T[];
declare function resolveAsArrayOrUndefined<T>(value: T | T[] | undefined | null): T extends undefined | null ? undefined : T[];
declare function getOrigin(url: string | URL): string | undefined;
export { resolveAsArrayOrUndefined, resolveArray, getOrigin };

View File

@@ -0,0 +1,52 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
getOrigin: null,
resolveArray: null,
resolveAsArrayOrUndefined: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
getOrigin: function() {
return getOrigin;
},
resolveArray: function() {
return resolveArray;
},
resolveAsArrayOrUndefined: function() {
return resolveAsArrayOrUndefined;
}
});
function resolveArray(value) {
if (Array.isArray(value)) {
return value;
}
return [
value
];
}
function resolveAsArrayOrUndefined(value) {
if (typeof value === 'undefined' || value === null) {
return undefined;
}
return resolveArray(value);
}
function getOrigin(url) {
let origin = undefined;
if (typeof url === 'string') {
try {
url = new URL(url);
origin = url.origin;
} catch {}
}
return origin;
}
//# sourceMappingURL=utils.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../src/lib/metadata/generate/utils.ts"],"sourcesContent":["function resolveArray<T>(value: T | T[]): T[] {\n if (Array.isArray(value)) {\n return value as any\n }\n return [value] as any\n}\n\nfunction resolveAsArrayOrUndefined<T>(\n value: T | T[] | undefined | null\n): T extends undefined | null ? undefined : T[] {\n if (typeof value === 'undefined' || value === null) {\n return undefined as any\n }\n return resolveArray(value) as any\n}\n\nfunction getOrigin(url: string | URL): string | undefined {\n let origin = undefined\n if (typeof url === 'string') {\n try {\n url = new URL(url)\n origin = url.origin\n } catch {}\n }\n return origin\n}\n\nexport { resolveAsArrayOrUndefined, resolveArray, getOrigin }\n"],"names":["getOrigin","resolveArray","resolveAsArrayOrUndefined","value","Array","isArray","undefined","url","origin","URL"],"mappings":";;;;;;;;;;;;;;;;IA2BkDA,SAAS;eAATA;;IAAdC,YAAY;eAAZA;;IAA3BC,yBAAyB;eAAzBA;;;AA3BT,SAASD,aAAgBE,KAAc;IACrC,IAAIC,MAAMC,OAAO,CAACF,QAAQ;QACxB,OAAOA;IACT;IACA,OAAO;QAACA;KAAM;AAChB;AAEA,SAASD,0BACPC,KAAiC;IAEjC,IAAI,OAAOA,UAAU,eAAeA,UAAU,MAAM;QAClD,OAAOG;IACT;IACA,OAAOL,aAAaE;AACtB;AAEA,SAASH,UAAUO,GAAiB;IAClC,IAAIC,SAASF;IACb,IAAI,OAAOC,QAAQ,UAAU;QAC3B,IAAI;YACFA,MAAM,IAAIE,IAAIF;YACdC,SAASD,IAAIC,MAAM;QACrB,EAAE,OAAM,CAAC;IACX;IACA,OAAOA;AACT","ignoreList":[0]}