@@ -4,44 +4,6 @@ import { getPageMap } from 'nextra/page-map'
44import 'nextra-theme-docs/style.css'
55import './globals.css'
66
7- const repositoryName = process . env . GITHUB_REPOSITORY ?. split ( '/' ) [ 1 ] || ''
8- const isUserOrOrgPage = repositoryName . endsWith ( '.github.io' )
9- const basePath = repositoryName && ! isUserOrOrgPage ? `/${ repositoryName } ` : ''
10-
11- const withBasePath = ( value ) => {
12- if ( ! basePath || typeof value !== 'string' || ! value . startsWith ( '/' ) || value . startsWith ( '//' ) ) {
13- return value
14- }
15-
16- if ( value === basePath || value . startsWith ( `${ basePath } /` ) ) {
17- return value
18- }
19-
20- return `${ basePath } ${ value } `
21- }
22-
23- const normalizePageMap = ( node ) => {
24- if ( Array . isArray ( node ) ) {
25- return node . map ( normalizePageMap )
26- }
27-
28- if ( ! node || typeof node !== 'object' ) {
29- return node
30- }
31-
32- const normalized = { }
33-
34- for ( const [ key , value ] of Object . entries ( node ) ) {
35- if ( ( key === 'route' || key === 'href' ) && typeof value === 'string' ) {
36- normalized [ key ] = withBasePath ( value )
37- } else {
38- normalized [ key ] = normalizePageMap ( value )
39- }
40- }
41-
42- return normalized
43- }
44-
457export const metadata = {
468 title : {
479 default : 'nano-css — Tiny CSS-in-JS Library' ,
@@ -71,8 +33,6 @@ const footer = (
7133)
7234
7335export default async function RootLayout ( { children } ) {
74- const pageMap = normalizePageMap ( await getPageMap ( ) )
75-
7636 return (
7737 < html lang = "en" dir = "ltr" suppressHydrationWarning >
7838 < Head >
@@ -81,7 +41,7 @@ export default async function RootLayout({ children }) {
8141 < body >
8242 < Layout
8343 navbar = { navbar }
84- pageMap = { pageMap }
44+ pageMap = { await getPageMap ( ) }
8545 docsRepositoryBase = "https://github.com/streamich/nano-css/tree/master/site"
8646 footer = { footer }
8747 sidebar = { { defaultMenuCollapseLevel : 1 } }
0 commit comments