(Example) Update with-opentelemetry
example. (#54775)
Updated with new `Metadata` API. Here in this example there is `legacy.tsx` in `/pages` folder should i remove it or retain it?? Also in `/pages/legacy.tsx` we have defined `/preact-stars` route but we don't have the corresponding file. I have remove `/preact-stars` from `/app/page.tsx` as there is no `/app/preact-stars/page.tsx` in this example. And `/shared/fetch-github-stars.ts` is fetching only `next.js` stars. Co-authored-by: Lee Robinson <9113740+leerob@users.noreply.github.com>
This commit is contained in:
parent
e94868215d
commit
c56f9f4ff9
2 changed files with 15 additions and 15 deletions
|
@ -1,12 +1,18 @@
|
||||||
export default function Layout({ children }) {
|
import type { Metadata } from 'next'
|
||||||
|
|
||||||
|
export const metadata: Metadata = {
|
||||||
|
title: 'Next.js with OpenTelemetry',
|
||||||
|
description: 'Next.js with OpenTelemetry',
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function RootLayout({
|
||||||
|
children,
|
||||||
|
}: {
|
||||||
|
children: React.ReactNode
|
||||||
|
}) {
|
||||||
return (
|
return (
|
||||||
<html>
|
<html lang="en">
|
||||||
<head>
|
<body>{children}</body>
|
||||||
<title>Next.js with OpenTelemetry</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<main>{children}</main>
|
|
||||||
</body>
|
|
||||||
</html>
|
</html>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,6 @@
|
||||||
import Link from 'next/link'
|
|
||||||
import { fetchGithubStars } from '../shared/fetch-github-stars'
|
import { fetchGithubStars } from '../shared/fetch-github-stars'
|
||||||
|
|
||||||
export default async function Page() {
|
export default async function Page() {
|
||||||
const stars = await fetchGithubStars()
|
const stars = await fetchGithubStars()
|
||||||
return (
|
return <p>Next.js has {stars} ⭐️</p>
|
||||||
<>
|
|
||||||
<p>Next.js has {stars} ⭐️</p>
|
|
||||||
<Link href="/preact-stars">How about preact?</Link>
|
|
||||||
</>
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue