@publish.os/nextjs 0.0.1-alpha.91 → 0.0.1-alpha.92
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/compiler-assets/nextjs/defaults/group/index.tsx +16 -11
- package/compiler-assets/nextjs/defaults/group/layout.tsx +6 -2
- package/compiler-assets/nextjs/defaults/group/page.tsx +7 -6
- package/compiler-assets/nextjs/defaults/project/next.config.mjs +2 -1
- package/compiler-assets/nextjs/defaults/root/index.tsx +16 -11
- package/compiler-assets/nextjs/defaults/root/layout.tsx +7 -3
- package/compiler-assets/nextjs/shims/agent-user-agents.ts +65 -0
- package/compiler-assets/nextjs/shims/document.tsx +9 -1
- package/compiler-assets/nextjs/shims/generated-leaf-page.tsx +3 -0
- package/compiler-assets/nextjs/shims/proxy.ts +156 -54
- package/dist/{build-operation-5QMLXF7N.js → build-operation-CJDUL4OW.js} +5 -5
- package/dist/{chunk-GBPLER5H.js → chunk-3T4HVDSC.js} +2 -2
- package/dist/{chunk-UYGCOWRF.js → chunk-DX7PXFCM.js} +860 -50
- package/dist/{chunk-F3AGNDF4.js → chunk-DZ3VWEV5.js} +860 -575
- package/dist/{chunk-OXOFRXEI.js → chunk-NHSLTARU.js} +1284 -1164
- package/dist/{chunk-ORIUWJBQ.js → chunk-SBMDONTV.js} +3 -2
- package/dist/compiler.js +42 -23
- package/dist/components/blocks/agent-actions.d.ts +7 -7
- package/dist/components/blocks/agent-actions.js +1 -32
- package/dist/components/blocks/toc.d.ts +7 -7
- package/dist/components/ui/button.d.ts +1 -2
- package/dist/{compose-CVBJRAF6.js → compose-44GJSMXD.js} +2 -2
- package/dist/config/createNextConfig.js +2 -0
- package/dist/{dev-operation-OSHHWRWK.js → dev-operation-WNECBHZ5.js} +17 -7
- package/dist/{ide-support-CU6Z5PVR.js → ide-support-TG74L4FF.js} +3 -3
- package/dist/index.d.ts +143 -126
- package/dist/index.js +25 -0
- package/dist/kernel/components/blocks/AgentActions.d.ts +7 -7
- package/dist/kernel/components/blocks/AgentActions.js +1 -32
- package/dist/kernel/components/blocks/agent-actions.d.ts +1 -2
- package/dist/kernel/components/blocks/agent-actions.js +1 -32
- package/dist/kernel/components/blocks/animated-icon-swap.d.ts +2 -2
- package/dist/kernel/components/blocks/color-palette.d.ts +2 -2
- package/dist/kernel/components/blocks/logo-block.d.ts +2 -2
- package/dist/kernel/components/blocks/nav-breadcrumb.d.ts +6 -5
- package/dist/kernel/components/blocks/nav-breadcrumb.js +19 -13
- package/dist/kernel/components/blocks/navbar.d.ts +5 -4
- package/dist/kernel/components/blocks/navbar.js +62 -42
- package/dist/kernel/components/blocks/navigation-progress.d.ts +2 -2
- package/dist/kernel/components/blocks/next-prev.d.ts +4 -4
- package/dist/kernel/components/blocks/next-prev.js +29 -6
- package/dist/kernel/components/blocks/page-list.d.ts +4 -4
- package/dist/kernel/components/blocks/page-list.js +30 -7
- package/dist/kernel/components/blocks/search.d.ts +9 -15
- package/dist/kernel/components/blocks/sidebar-node.d.ts +3 -5
- package/dist/kernel/components/blocks/sidebar-node.js +12 -2
- package/dist/kernel/components/blocks/sidebar.d.ts +6 -7
- package/dist/kernel/components/blocks/sidebar.js +132 -26
- package/dist/kernel/components/blocks/theme-toggle.d.ts +3 -4
- package/dist/kernel/components/blocks/toc-client.d.ts +7 -7
- package/dist/kernel/components/blocks/toc.d.ts +3 -3
- package/dist/kernel/components/mdx/components/blockquote.d.ts +2 -2
- package/dist/kernel/components/mdx/components/callout.d.ts +3 -3
- package/dist/kernel/components/mdx/components/code-block.d.ts +2 -2
- package/dist/kernel/components/mdx/components/copy-code-button.d.ts +2 -2
- package/dist/kernel/components/mdx/components/figure-caption.d.ts +2 -2
- package/dist/kernel/components/mdx/components/figure.d.ts +3 -3
- package/dist/kernel/components/mdx/components/footnotes.d.ts +2 -2
- package/dist/kernel/components/mdx/components/heading-copy-link.d.ts +2 -2
- package/dist/kernel/components/mdx/components/heading.d.ts +2 -2
- package/dist/kernel/components/mdx/components/hr.d.ts +4 -4
- package/dist/kernel/components/mdx/components/image-zoom.d.ts +3 -3
- package/dist/kernel/components/mdx/components/image-zoom.js +3 -2
- package/dist/kernel/components/mdx/components/image.d.ts +2 -2
- package/dist/kernel/components/mdx/components/image.js +1 -1
- package/dist/kernel/components/mdx/components/inline-code.d.ts +2 -2
- package/dist/kernel/components/mdx/components/kbd.d.ts +3 -3
- package/dist/kernel/components/mdx/components/link.d.ts +3 -3
- package/dist/kernel/components/mdx/components/paragraph.d.ts +2 -2
- package/dist/kernel/components/mdx/components/strikethrough.d.ts +2 -2
- package/dist/kernel/components/mdx/components/table.d.ts +7 -7
- package/dist/kernel/components/mdx/components/task-list.d.ts +3 -3
- package/dist/kernel/components/mdx/components/video-player.d.ts +2 -2
- package/dist/kernel/components/mdx/components/video.d.ts +2 -3
- package/dist/kernel/components/mdx/error-boundary.d.ts +2 -3
- package/dist/kernel/components/mdx/error-fallback.d.ts +2 -2
- package/dist/kernel/components/mdx/mdx.d.ts +42 -11
- package/dist/kernel/components/mdx/mdx.js +1 -1
- package/dist/kernel/components/next-image.d.ts +3 -3
- package/dist/kernel/components/ui/accordion.d.ts +7 -7
- package/dist/kernel/components/ui/breadcrumb-trail.d.ts +2 -3
- package/dist/kernel/components/ui/breadcrumb.d.ts +13 -13
- package/dist/kernel/components/ui/button-group.d.ts +5 -5
- package/dist/kernel/components/ui/button.d.ts +3 -3
- package/dist/kernel/components/ui/card.d.ts +7 -7
- package/dist/kernel/components/ui/dialog.d.ts +10 -10
- package/dist/kernel/components/ui/drawer.d.ts +12 -12
- package/dist/kernel/components/ui/kbd.d.ts +3 -3
- package/dist/kernel/components/ui/link.d.ts +3 -3
- package/dist/kernel/components/ui/menu.d.ts +22 -22
- package/dist/kernel/components/ui/mod-key.d.ts +2 -3
- package/dist/kernel/components/ui/navigation-menu.d.ts +15 -15
- package/dist/kernel/components/ui/popover.d.ts +11 -11
- package/dist/kernel/components/ui/progress.d.ts +7 -7
- package/dist/kernel/components/ui/scroll-area.d.ts +1 -2
- package/dist/kernel/components/ui/select.d.ts +16 -16
- package/dist/kernel/components/ui/separator.d.ts +3 -3
- package/dist/kernel/components/ui/table.d.ts +7 -7
- package/dist/kernel/components/ui/tabs.d.ts +12 -12
- package/dist/kernel/components/ui/tag.d.ts +3 -3
- package/dist/kernel/components/ui/text.d.ts +4 -4
- package/dist/kernel/components/ui/toast.d.ts +11 -11
- package/dist/kernel/components/ui/tooltip.d.ts +9 -9
- package/dist/kernel/defaults.registry.d.ts +2 -2
- package/dist/kernel/defaults.registry.js +2 -2
- package/dist/kernel/routes/agent/markdown.d.ts +4 -0
- package/dist/kernel/routes/agent/markdown.js +11 -7
- package/dist/kernel/routes/layouts/group.d.ts +1 -1
- package/dist/kernel/routes/metadata/feed.d.ts +1 -2
- package/dist/kernel/routes/metadata/feed.js +34 -29
- package/dist/kernel/routes/metadata/llms.d.ts +3 -31
- package/dist/kernel/routes/metadata/llms.js +2 -200
- package/dist/kernel/routes/metadata/robots.d.ts +5 -3
- package/dist/kernel/routes/metadata/robots.js +4 -25
- package/dist/kernel/routes/metadata/sitemap.d.ts +15 -1
- package/dist/kernel/routes/metadata/sitemap.js +200 -112
- package/dist/kernel/routes/not-found.js +1 -1
- package/dist/kernel/routes/pages/group.d.ts +3 -3
- package/dist/kernel/routes/pages/group.js +10 -4
- package/dist/kernel/routes/pages/leaf.d.ts +9 -4
- package/dist/kernel/routes/pages/leaf.js +16 -8
- package/dist/kernel/routes/pages/root.d.ts +3 -3
- package/dist/kernel/routes/pages/root.js +20 -5
- package/dist/keyboard-shortcuts.d.ts +2 -2
- package/dist/manifest-types-CcVPH_jh.d.ts +83 -0
- package/dist/resolvers/manifest-resolver.d.ts +2 -2
- package/dist/resolvers/manifest-resolver.js +65 -35
- package/dist/search.d.ts +2 -9
- package/dist/search.js +2 -7
- package/dist/sidebar-types-CMrMM0Nj.d.ts +105 -0
- package/dist/theme-scope.d.ts +2 -2
- package/dist/types-BbqmOzLC.d.ts +168 -0
- package/dist/types-TjH1ek0X.d.ts +22 -0
- package/dist/types.d.ts +116 -91
- package/dist/{validate-local-source-SV44DBQT.js → validate-local-source-EN2GW4FR.js} +3 -3
- package/dist/{validate-publish-os-source-NZJF3TB2.js → validate-publish-os-source-OEWQDB7B.js} +2 -2
- package/init/seed/minimal/publish.os/blog/index.tsx +25 -22
- package/init/seed/minimal/publish.os/blog/page.tsx +31 -16
- package/init/seed/minimal/publish.os/components/blog/copy-link.tsx +1 -1
- package/init/seed/minimal/publish.os/components/blog/frontmatter.ts +41 -0
- package/init/seed/minimal/publish.os/publish.os.config.json +13 -2
- package/init/seed/minimal/seed.json +1 -0
- package/init/seed/scratch/publish.os/publish.os.config.json +1 -1
- package/package.json +4 -4
- package/release/app/phosphor/package.json +1 -1
- package/release/app/phosphor/pnpm-lock.yaml.template +53 -127
- package/release/compiler/pnpm-lock.yaml.template +49 -123
- package/release/release.json +4 -4
- package/dist/sidebar-types-DKpR27II.d.ts +0 -25
- package/dist/types-CJWRG05y.d.ts +0 -76
- package/dist/types-CUtrppxt.d.ts +0 -69
- package/dist/types-J2w_puPF.d.ts +0 -128
- package/dist/{button-BdCScEKi.d.ts → button-D6Xp2HBm.d.ts} +1 -1
|
@@ -1,43 +1,48 @@
|
|
|
1
1
|
import { Link } from "@components/ui/link";
|
|
2
2
|
import type {
|
|
3
3
|
IndexPageProps,
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
NavigationNode,
|
|
5
|
+
NavigationPageNode,
|
|
6
6
|
} from "@publish.os/nextjs/types";
|
|
7
7
|
import { log } from "@source/_internal/logger";
|
|
8
8
|
|
|
9
|
-
function pageNodes(nodes:
|
|
9
|
+
function pageNodes(nodes: NavigationNode[]): NavigationPageNode[] {
|
|
10
10
|
return nodes.flatMap((node) => {
|
|
11
11
|
if (node.type === "page") return [node];
|
|
12
|
-
if (
|
|
12
|
+
if (
|
|
13
|
+
node.type === "section" ||
|
|
14
|
+
node.type === "folder" ||
|
|
15
|
+
node.type === "group"
|
|
16
|
+
) {
|
|
13
17
|
return pageNodes(node.children);
|
|
14
18
|
}
|
|
19
|
+
if (node.type === "view") return pageNodes(node.items);
|
|
15
20
|
return [];
|
|
16
21
|
});
|
|
17
22
|
}
|
|
18
23
|
|
|
19
24
|
export default function GroupPage(props: IndexPageProps) {
|
|
20
25
|
log.debug("[default:group-page]", props);
|
|
21
|
-
const { node,
|
|
22
|
-
const pages = pageNodes(
|
|
26
|
+
const { node, navigation } = props;
|
|
27
|
+
const pages = pageNodes(navigation.items);
|
|
23
28
|
|
|
24
29
|
return (
|
|
25
30
|
<div className="flex min-h-[calc(100vh-var(--layout-global-nav-height))] min-w-0 items-start justify-center px-6 pb-16 pt-[clamp(5rem,18vh,10rem)] text-foreground-1 lg:px-10 supports-[height:100dvh]:min-h-[calc(100dvh-var(--layout-global-nav-height))] supports-[top:anchor-size(--global-navbar_height)]:min-h-[calc(100vh-anchor-size(--global-navbar_height,3.5rem))] supports-[top:anchor-size(--global-navbar_height)]:supports-[height:100dvh]:min-h-[calc(100dvh-anchor-size(--global-navbar_height,3.5rem))]">
|
|
26
31
|
<div className="w-full max-w-md">
|
|
27
32
|
<p className="mb-6 text-sm font-semibold text-foreground-1">
|
|
28
|
-
{node.
|
|
33
|
+
{node.label}
|
|
29
34
|
</p>
|
|
30
35
|
<h1 className="max-w-sm text-balance text-xl font-semibold leading-7 tracking-tight text-foreground-1">
|
|
31
36
|
Browse the pages in this section.
|
|
32
37
|
</h1>
|
|
33
38
|
|
|
34
39
|
{pages.length > 0 ? (
|
|
35
|
-
<nav aria-label={`${node.
|
|
40
|
+
<nav aria-label={`${node.label} pages`} className="mt-8">
|
|
36
41
|
<ul className="flex flex-col gap-2 text-sm">
|
|
37
42
|
{pages.map((page) => (
|
|
38
|
-
<li key={
|
|
39
|
-
<Link href={page.
|
|
40
|
-
{page.
|
|
43
|
+
<li key={page.id}>
|
|
44
|
+
<Link href={page.href} rightIcon="->" size="sm">
|
|
45
|
+
{page.label}
|
|
41
46
|
</Link>
|
|
42
47
|
</li>
|
|
43
48
|
))}
|
|
@@ -3,13 +3,17 @@ import type { LayoutProps } from "@publish.os/nextjs/types";
|
|
|
3
3
|
import { log } from "@source/_internal/logger";
|
|
4
4
|
|
|
5
5
|
export default function GroupLayout(props: LayoutProps) {
|
|
6
|
-
const { children, currentPath, group, node,
|
|
6
|
+
const { children, currentPath, group, node, navigation } = props;
|
|
7
7
|
log.debug("[default:group-layout]", { currentPath, group });
|
|
8
8
|
|
|
9
9
|
return (
|
|
10
10
|
<section className="mx-auto grid min-h-[calc(100vh-var(--layout-global-nav-height))] w-full max-w-(--layout-site-max-width) grid-cols-1 border-x border-stroke-3 bg-surface-1 md:grid-cols-[var(--layout-sidebar-width)_minmax(0,1fr)] xl:grid-cols-[var(--layout-sidebar-width)_minmax(0,1fr)_var(--layout-toc-width)] supports-[height:100dvh]:min-h-[calc(100dvh-var(--layout-global-nav-height))] supports-[top:anchor-size(--global-navbar_height)]:min-h-[calc(100vh-anchor-size(--global-navbar_height,3.5rem))] supports-[top:anchor-size(--global-navbar_height)]:supports-[height:100dvh]:min-h-[calc(100dvh-anchor-size(--global-navbar_height,3.5rem))]">
|
|
11
11
|
<aside className="fixed top-(--layout-global-nav-height) z-content hidden h-[calc(100vh-var(--layout-global-nav-height))] min-h-0 border-l border-stroke-3 bg-surface-1 md:left-[max(0px,calc((100%-var(--layout-site-max-width))/2))] md:flex md:w-(--layout-sidebar-width) supports-[height:100dvh]:h-[calc(100dvh-var(--layout-global-nav-height))] supports-[top:anchor-size(--global-navbar_height)]:top-[anchor-size(--global-navbar_height,3.5rem)] supports-[top:anchor-size(--global-navbar_height)]:h-[calc(100vh-anchor-size(--global-navbar_height,3.5rem))] supports-[top:anchor-size(--global-navbar_height)]:supports-[height:100dvh]:h-[calc(100dvh-anchor-size(--global-navbar_height,3.5rem))]">
|
|
12
|
-
<Sidebar
|
|
12
|
+
<Sidebar
|
|
13
|
+
currentPath={currentPath}
|
|
14
|
+
title={node.label}
|
|
15
|
+
navigation={navigation}
|
|
16
|
+
/>
|
|
13
17
|
</aside>
|
|
14
18
|
<main
|
|
15
19
|
className="flex min-h-0 min-w-0 flex-1 scroll-mt-[calc(var(--layout-global-nav-height)+1rem)] flex-col bg-surface-1 md:col-start-2"
|
|
@@ -8,10 +8,10 @@ import { log } from "@source/_internal/logger";
|
|
|
8
8
|
export default async function ContentPage(props: PageProps) {
|
|
9
9
|
log.debug("[default:content-page]", props);
|
|
10
10
|
const sourceUrl =
|
|
11
|
-
typeof props.page.
|
|
12
|
-
? props.page.
|
|
13
|
-
: typeof props.page.
|
|
14
|
-
? props.page.
|
|
11
|
+
typeof props.page.frontmatter.sourceUrl === "string"
|
|
12
|
+
? props.page.frontmatter.sourceUrl
|
|
13
|
+
: typeof props.page.frontmatter.githubUrl === "string"
|
|
14
|
+
? props.page.frontmatter.githubUrl
|
|
15
15
|
: undefined;
|
|
16
16
|
|
|
17
17
|
return (
|
|
@@ -20,13 +20,14 @@ export default async function ContentPage(props: PageProps) {
|
|
|
20
20
|
content={props.page.body}
|
|
21
21
|
desktopClassName="xl:absolute xl:inset-y-0 xl:start-full xl:w-(--layout-toc-width) xl:px-3 xl:py-10"
|
|
22
22
|
desktopListClassName="xl:sticky xl:top-[calc(var(--layout-global-nav-height)_+_1.5rem)] xl:max-h-[calc(100dvh-var(--layout-global-nav-height)-3rem)] xl:overflow-y-auto supports-[top:anchor-size(--global-navbar_height)]:xl:top-[calc(anchor-size(--global-navbar_height,3.5rem)_+_1.5rem)] supports-[top:anchor-size(--global-navbar_height)]:xl:max-h-[calc(100dvh-anchor-size(--global-navbar_height,3.5rem)-3rem)]"
|
|
23
|
+
mobileClassName="sticky top-(--layout-global-nav-height) z-nav supports-[top:anchor-size(--global-navbar_height)]:top-[anchor-size(--global-navbar_height,3.5rem)]"
|
|
23
24
|
mobileQuery="(max-width: 1279px)"
|
|
24
25
|
/>
|
|
25
26
|
<div className="flex min-w-0 flex-1 flex-col px-6 py-10 lg:px-10">
|
|
26
27
|
<div className="mx-auto flex w-full max-w-(--layout-content-max-width) flex-1 flex-col">
|
|
27
28
|
<article className="min-h-0 min-w-0 flex-1">
|
|
28
29
|
<h1 className="text-3xl font-semibold tracking-tight text-foreground-1">
|
|
29
|
-
{props.page.title}
|
|
30
|
+
{props.page.frontmatter.title}
|
|
30
31
|
</h1>
|
|
31
32
|
<AgentActions
|
|
32
33
|
className="mt-4"
|
|
@@ -42,7 +43,7 @@ export default async function ContentPage(props: PageProps) {
|
|
|
42
43
|
<NextPrev
|
|
43
44
|
className="mt-auto pt-12"
|
|
44
45
|
currentPath={props.currentPath}
|
|
45
|
-
|
|
46
|
+
navigation={props.navigation}
|
|
46
47
|
/>
|
|
47
48
|
</div>
|
|
48
49
|
</div>
|
|
@@ -11,12 +11,13 @@ const NEXT_IMAGE_OPTIMIZER_PATH = "__PUBLISHOS_NEXT_IMAGE_PATH__";
|
|
|
11
11
|
|
|
12
12
|
/** @type {import("next").NextConfig} */
|
|
13
13
|
export default {
|
|
14
|
+
env: { PUBLISHOS_SITE_BUILD_TIME: new Date().toISOString() },
|
|
14
15
|
assetPrefix: INTERNAL_PREFIX,
|
|
15
16
|
cacheComponents: true,
|
|
16
17
|
// Preserve loopback origins so internal rewrites do not proxy back into this app.
|
|
17
18
|
skipProxyUrlNormalize: true,
|
|
18
19
|
experimental: { globalNotFound: true },
|
|
19
|
-
partialPrefetching:
|
|
20
|
+
partialPrefetching: true,
|
|
20
21
|
// macOS native notifications can delay preview updates. Use Next's fallback.
|
|
21
22
|
watchOptions:
|
|
22
23
|
process.platform === "darwin" ? { pollIntervalMs: 1_000 } : undefined,
|
|
@@ -1,25 +1,30 @@
|
|
|
1
1
|
import { Link } from "@components/ui/link";
|
|
2
2
|
import type {
|
|
3
|
-
|
|
3
|
+
NavigationGroupNode,
|
|
4
|
+
NavigationLinkNode,
|
|
4
5
|
RootPageProps,
|
|
5
|
-
SectionNode,
|
|
6
|
-
TreeNode,
|
|
7
6
|
} from "@publish.os/nextjs/types";
|
|
8
7
|
import { log } from "@source/_internal/logger";
|
|
9
8
|
|
|
10
|
-
type RootNavNode =
|
|
9
|
+
type RootNavNode = NavigationLinkNode | NavigationGroupNode;
|
|
11
10
|
|
|
12
|
-
function rootNavNodes(
|
|
11
|
+
function rootNavNodes(
|
|
12
|
+
nodes: RootPageProps["navigation"]["items"],
|
|
13
|
+
): RootNavNode[] {
|
|
13
14
|
return nodes.filter((node): node is RootNavNode => {
|
|
14
15
|
if (node.type === "link") return true;
|
|
15
|
-
return
|
|
16
|
+
return (
|
|
17
|
+
node.type === "group" &&
|
|
18
|
+
node.presentation === "page" &&
|
|
19
|
+
Boolean(node.href)
|
|
20
|
+
);
|
|
16
21
|
});
|
|
17
22
|
}
|
|
18
23
|
|
|
19
24
|
export default function HomePage(props: RootPageProps) {
|
|
20
25
|
log.debug("[default:root-page]", props);
|
|
21
|
-
const { site,
|
|
22
|
-
const navNodes = rootNavNodes(
|
|
26
|
+
const { site, navigation } = props;
|
|
27
|
+
const navNodes = rootNavNodes(navigation.items);
|
|
23
28
|
|
|
24
29
|
return (
|
|
25
30
|
<section className="mx-auto grid min-h-[calc(100vh-var(--layout-global-nav-height))] w-full max-w-(--layout-site-max-width) grid-cols-1 border-x border-stroke-3 bg-surface-1 md:grid-cols-[var(--layout-sidebar-width)_minmax(0,1fr)_var(--layout-toc-width)] supports-[height:100dvh]:min-h-[calc(100dvh-var(--layout-global-nav-height))] supports-[top:anchor-size(--global-navbar_height)]:min-h-[calc(100vh-anchor-size(--global-navbar_height,3.5rem))] supports-[top:anchor-size(--global-navbar_height)]:supports-[height:100dvh]:min-h-[calc(100dvh-anchor-size(--global-navbar_height,3.5rem))]">
|
|
@@ -45,11 +50,11 @@ export default function HomePage(props: RootPageProps) {
|
|
|
45
50
|
<li key={node.id}>
|
|
46
51
|
{node.type === "link" ? (
|
|
47
52
|
<Link href={node.href} rightIcon="->" size="sm">
|
|
48
|
-
{node.
|
|
53
|
+
{node.label}
|
|
49
54
|
</Link>
|
|
50
55
|
) : (
|
|
51
|
-
<Link href={node.
|
|
52
|
-
{node.
|
|
56
|
+
<Link href={node.href} rightIcon="->" size="sm">
|
|
57
|
+
{node.label}
|
|
53
58
|
</Link>
|
|
54
59
|
)}
|
|
55
60
|
</li>
|
|
@@ -4,10 +4,10 @@ import { faviconsAndLogos } from "@source/.publishos/favicons-and-logos.generate
|
|
|
4
4
|
import { log } from "@source/_internal/logger";
|
|
5
5
|
|
|
6
6
|
export default function DefaultRootLayout(props: RootLayoutProps) {
|
|
7
|
-
const { children, site,
|
|
7
|
+
const { children, site, navigation } = props;
|
|
8
8
|
log.debug("[default:root-layout]", {
|
|
9
9
|
site: site.name,
|
|
10
|
-
|
|
10
|
+
navigationItems: navigation.items.length,
|
|
11
11
|
});
|
|
12
12
|
|
|
13
13
|
return (
|
|
@@ -18,7 +18,11 @@ export default function DefaultRootLayout(props: RootLayoutProps) {
|
|
|
18
18
|
>
|
|
19
19
|
Skip to content
|
|
20
20
|
</a>
|
|
21
|
-
<Navbar
|
|
21
|
+
<Navbar
|
|
22
|
+
logo={faviconsAndLogos.logo}
|
|
23
|
+
site={site}
|
|
24
|
+
navigation={navigation}
|
|
25
|
+
/>
|
|
22
26
|
<div className="flex w-full flex-1 flex-col">{children}</div>
|
|
23
27
|
</div>
|
|
24
28
|
);
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
// HTTP User-Agent product names that select Markdown when Accept leaves a tie.
|
|
2
|
+
// Keep crawler names separate from general HTTP clients. A name is a hint, not
|
|
3
|
+
// proof of identity. Check vendor documentation before adding a crawler.
|
|
4
|
+
const AI_CRAWLERS = [
|
|
5
|
+
// https://developers.openai.com/api/docs/bots
|
|
6
|
+
"OAI-SearchBot",
|
|
7
|
+
"GPTBot",
|
|
8
|
+
"ChatGPT-User",
|
|
9
|
+
// https://support.claude.com/en/articles/8896518
|
|
10
|
+
"ClaudeBot",
|
|
11
|
+
"Claude-SearchBot",
|
|
12
|
+
"Claude-User",
|
|
13
|
+
// https://docs.perplexity.ai/docs/resources/perplexity-crawlers
|
|
14
|
+
"PerplexityBot",
|
|
15
|
+
"Perplexity-User",
|
|
16
|
+
// https://developers.google.com/crawling/docs/crawlers-fetchers/google-user-triggered-fetchers
|
|
17
|
+
"Google-Agent",
|
|
18
|
+
"Google-GeminiNotebook",
|
|
19
|
+
// https://developers.google.com/crawling/docs/crawlers-fetchers/google-common-crawlers
|
|
20
|
+
"Google-CloudVertexBot",
|
|
21
|
+
];
|
|
22
|
+
|
|
23
|
+
// General HTTP clients follow the existing Markdown tie-break policy.
|
|
24
|
+
const HTTP_CLIENTS = [
|
|
25
|
+
"axios",
|
|
26
|
+
"got",
|
|
27
|
+
"node-fetch",
|
|
28
|
+
"undici",
|
|
29
|
+
"curl",
|
|
30
|
+
"wget",
|
|
31
|
+
"python-requests",
|
|
32
|
+
"httpx",
|
|
33
|
+
"aiohttp",
|
|
34
|
+
];
|
|
35
|
+
|
|
36
|
+
// Other client product names are not verified crawler identities.
|
|
37
|
+
const CLIENT_PRODUCTS = [
|
|
38
|
+
"claude-code",
|
|
39
|
+
"claude",
|
|
40
|
+
"cursor",
|
|
41
|
+
"chatgpt",
|
|
42
|
+
"openai",
|
|
43
|
+
"perplexity",
|
|
44
|
+
"anthropic-ai",
|
|
45
|
+
];
|
|
46
|
+
|
|
47
|
+
const SUPPORTED_PRODUCTS = new Set(
|
|
48
|
+
[...AI_CRAWLERS, ...HTTP_CLIENTS, ...CLIENT_PRODUCTS].map((name) =>
|
|
49
|
+
name.toLowerCase(),
|
|
50
|
+
),
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
export function isMarkdownClient(userAgent: string): boolean {
|
|
54
|
+
// Match whole product names, including those inside a compatible comment.
|
|
55
|
+
// A preceding slash is excluded so a URL in a comment is not a product.
|
|
56
|
+
const products = /(?:^|[\s(;])([A-Za-z0-9!#$%&'*+.^_`|~-]+)(?=\/|[\s;)]|$)/g;
|
|
57
|
+
for (
|
|
58
|
+
let product = products.exec(userAgent);
|
|
59
|
+
product;
|
|
60
|
+
product = products.exec(userAgent)
|
|
61
|
+
) {
|
|
62
|
+
if (SUPPORTED_PRODUCTS.has(product[1].toLowerCase())) return true;
|
|
63
|
+
}
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
@@ -27,7 +27,15 @@ export default function SiteDocument({
|
|
|
27
27
|
{beforeShell}
|
|
28
28
|
<BodyWrapper>
|
|
29
29
|
<Providers>
|
|
30
|
-
<RootLayout
|
|
30
|
+
<RootLayout
|
|
31
|
+
site={manifest.site}
|
|
32
|
+
navigation={
|
|
33
|
+
manifest.groups.__root?.navigation ?? {
|
|
34
|
+
rootGroup: "__root",
|
|
35
|
+
items: [],
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
>
|
|
31
39
|
{children}
|
|
32
40
|
</RootLayout>
|
|
33
41
|
</Providers>
|
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
createLeafPage,
|
|
6
6
|
createLeafStaticParams,
|
|
7
7
|
} from "@publish.os/nextjs/kernel/routes/pages/leaf";
|
|
8
|
+
import { agentRouteConfig } from "@source/.publishos/agent-route-config.generated";
|
|
8
9
|
import { markdownArtifactManifest } from "@source/.publishos/markdown-index.generated";
|
|
9
10
|
import { ogManifest } from "@source/.publishos/og-manifest.generated";
|
|
10
11
|
import { groupThemes } from "@source/.theme.generated";
|
|
@@ -15,6 +16,8 @@ const route = {
|
|
|
15
16
|
group: __PUBLISHOS_GROUP_KEY__,
|
|
16
17
|
manifest,
|
|
17
18
|
markdownArtifactManifest,
|
|
19
|
+
markdownRoutesEnabled:
|
|
20
|
+
agentRouteConfig.enabled && agentRouteConfig.markdownRoutes,
|
|
18
21
|
ogManifest,
|
|
19
22
|
Leaf,
|
|
20
23
|
PoweredByFooter,
|