Skip to content

Commit

Permalink
[v4] add root _meta.global file (#3709)
Browse files Browse the repository at this point in the history
* aa

* use posix

* upd snapshots

* rm legacy code

* rm legacy code

* aa

* da

* da

* da

* da

* da

* da

* more

* more

* more

* more

* more

* more

* more

* more

* more

* more

* more

* aa

* getPageMap

* more

* more

* more

* more

* more

* more

* more

* more

* more

* more

* more

* more

* more

* more

* more

* more

* more

* more

* more

* more

* more

* more

* more

* more

* more

* more

* more

* more

* more

* more

* more

* more

* _meta.global

* _meta.global

* _meta.global

* _meta.global

* _meta.global

* _meta.global

* _meta.global

* _meta.global

* _meta.global

* changeset and prettier

* rm

* more

* lint

* fix cached compiler
  • Loading branch information
dimaMachina authored Nov 16, 2024
1 parent 0d9f736 commit 8a0ae0f
Show file tree
Hide file tree
Showing 128 changed files with 1,512 additions and 1,020 deletions.
17 changes: 17 additions & 0 deletions .changeset/long-birds-appear.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
'nextra-theme-blog': major
'nextra-theme-docs': major
'nextra': major
---

- add root `_meta.global.{js,jsx,ts,tsx}` file
- `getPageMap` now receive only 1 argument `root?: string = '/'` instead of 2 `lang?: string, route?: string = '/'`
- remove `createCatchAllMeta` from `nextra/catch-all`
- remove `collectCatchAllRoutes`
- remove `normalizePageRoute`
- add `mergeMetaWithPageMap` to `nextra/page-map`
- move adding `metadata.filePath`, `metadata.title` and `metadata.readingTime` in remark plugin
- refactor recma rewrite plugin and add tests
- remove `recmaRewriteJsx`
- remove `recmaRewriteFunctionBody`
- make `convertPageMapToJs` sync
131 changes: 131 additions & 0 deletions docs/app/_meta.global.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
export default {
index: {
type: 'page',
display: 'hidden'
},
docs: {
type: 'page',
title: 'Documentation',
items: {
index: '',
guide: {
items: {
'organize-files': '',
markdown: '',
'syntax-highlighting': '',
link: '',
image: '',
ssg: '',
i18n: '',
'custom-css': '',
'static-exports': '',
search: '',
'github-alert-syntax': '',
turbopack: ''
}
},
advanced: {
items: {
npm2yarn: '',
mermaid: '',
'tailwind-css': '',
latex: '',
table: '',
typescript: '',
remote: '',
playground: {
theme: {
layout: 'full'
}
}
}
},
'built-ins': {
items: {
_: {
type: 'separator',
title: 'Layout Components'
},
banner: '',
head: '',
search: '',
__: {
type: 'separator',
title: 'Content Components'
}
}
},
_: {
type: 'separator',
title: 'Themes'
},
'docs-theme': {
items: {
start: '',
'page-configuration': '',
'built-ins': ''
}
},
'blog-theme': '',
'custom-theme': '',
__: {
type: 'separator',
title: 'More'
},
'about-link': {
title: 'About Nextra',
href: '/about'
},
'next.js-link': {
title: 'Next.js Docs',
href: 'https://nextjs.org?utm_source=nextra.site&utm_medium=referral&utm_campaign=sidebar'
},
'migration-from-v3': {
title: 'Migration from Nextra v3',
href: 'https://the-guild.dev/blog/nextra-4?utm_source=nextra.site&utm_campaign=sidebar&utm_content=sidebar_link'
}
}
},
versions: {
type: 'menu',
title: 'Versions',
items: {
_3: {
title: 'Nextra v3 Docs',
href: 'https://nextra-v2-pyibc76cq-shud.vercel.app'
},
_2: {
title: 'Nextra v2 Docs',
href: 'https://nextra-v2-oe0zrpzjp-shud.vercel.app'
}
}
},
blog: {
type: 'page',
theme: {
typesetting: 'article'
}
},
about: {
type: 'page',
theme: {
typesetting: 'article'
}
},
showcase: {
type: 'page',
theme: {
typesetting: 'article',
layout: 'full',
timestamp: false
}
},
sponsors: {
type: 'page',
theme: {
typesetting: 'article',
layout: 'full',
timestamp: false
}
}
}
52 changes: 0 additions & 52 deletions docs/app/_meta.ts

This file was deleted.

29 changes: 0 additions & 29 deletions docs/app/docs/_meta.ts

This file was deleted.

14 changes: 0 additions & 14 deletions docs/app/docs/advanced/_meta.ts

This file was deleted.

2 changes: 1 addition & 1 deletion docs/app/docs/advanced/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { createIndexPage, getPageMap } from 'nextra/page-map'
# Advanced

<MDXRemote
compiledSource={await createIndexPage(await getPageMap('', '/docs/advanced'))}
compiledSource={await createIndexPage(await getPageMap('/docs/advanced'))}
components={{
Cards,
TerminalIcon,
Expand Down
4 changes: 1 addition & 3 deletions docs/app/docs/blog-theme/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ import { createIndexPage, getPageMap } from 'nextra/page-map'
# Nextra Blog Theme

<MDXRemote
compiledSource={await createIndexPage(
await getPageMap('', '/docs/blog-theme')
)}
compiledSource={await createIndexPage(await getPageMap('/docs/blog-theme'))}
components={{
Cards,
ChevronRightIcon
Expand Down
13 changes: 0 additions & 13 deletions docs/app/docs/built-ins/_meta.ts

This file was deleted.

4 changes: 1 addition & 3 deletions docs/app/docs/built-ins/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ Nextra includes a couple of built-in components that you can use to better style
your content:

<MDXRemote
compiledSource={await createIndexPage(
await getPageMap('', '/docs/built-ins')
)}
compiledSource={await createIndexPage(await getPageMap('/docs/built-ins'))}
components={{
Cards,
WarningIcon,
Expand Down
5 changes: 0 additions & 5 deletions docs/app/docs/docs-theme/_meta.ts

This file was deleted.

2 changes: 1 addition & 1 deletion docs/app/docs/docs-theme/built-ins/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { createIndexPage, getPageMap } from 'nextra/page-map'

<MDXRemote
compiledSource={await createIndexPage(
await getPageMap('', '/docs/docs-theme/built-ins')
await getPageMap('/docs/docs-theme/built-ins')
)}
components={{ Cards }}
/>
4 changes: 1 addition & 3 deletions docs/app/docs/docs-theme/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ import { MDXRemote } from 'nextra/mdx-remote'
import { createIndexPage, getPageMap } from 'nextra/page-map'

<MDXRemote
compiledSource={await createIndexPage(
await getPageMap('', '/docs/docs-theme')
)}
compiledSource={await createIndexPage(await getPageMap('/docs/docs-theme'))}
components={{
Cards,
ChevronRightIcon,
Expand Down
14 changes: 0 additions & 14 deletions docs/app/docs/guide/_meta.ts

This file was deleted.

2 changes: 1 addition & 1 deletion docs/app/docs/guide/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ The following features are configured via the Next.js configuration and are
available in all themes.

<MDXRemote
compiledSource={await createIndexPage(await getPageMap('', '/docs/guide'))}
compiledSource={await createIndexPage(await getPageMap('/docs/guide'))}
components={{
Cards,
FilesIcon,
Expand Down
4 changes: 3 additions & 1 deletion docs/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,16 @@ const RootLayout: FC<{
</p>
</Footer>
)
const pageMap = await getPageMap()

return (
<html lang="en" dir="ltr" suppressHydrationWarning>
<Head />
<body>
<Layout
banner={banner}
navbar={navbar}
pageMap={await getPageMap()}
pageMap={pageMap}
docsRepositoryBase="https://github.com/shuding/nextra/tree/main/docs"
editLink="Edit this page on GitHub"
sidebar={{ defaultMenuCollapseLevel: 1 }}
Expand Down
Loading

0 comments on commit 8a0ae0f

Please sign in to comment.