Skip to content

Docs usage-next-13.mdx: Add section on the new Metadata and reference invoke #851

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion app/pages/docs/usage-next-13.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,19 @@ export default function RootLayout({children}: {children: React.ReactNode}) {
)
}
```
#### Metadata {#metadata}

The app router requires a new way to set Metadata. Follow the [NextJS Documentation](https://nextjs.org/docs/app/building-your-application/optimizing/metadata). Thinks to rememeber for BlitzJS:

* Layouts and pages need to be server components which means you might have to extract interface elements that use hooks or browser APIs into separate client components first.
* Use the [`invoke` helper](blitz-rpc-invoke) to use the dynamic `function generateMetadata` with BlitJS queries. Example:
```ts
export async function generateMetadata({ params }) {
const project = await invoke(getProject, { id: params.projectId })
return { title: project?.name }
}
export default function Page() {)
```

#### Blitz Auth {#blitz-auth}

Expand Down Expand Up @@ -181,7 +194,7 @@ await useAuthenticatedBlitzContext({

The following method are to be used to invoke a resolver in a react server component

##### Using `invoke`
##### Using `invoke` {#blitz-rpc-invoke}

Let's say there is a requirement to query a resolver in the `(root)/page.js` file to check the details of the curretn user

Expand Down