Learn how to change your SEO meta tags and more
<script>
tag in the page component.metadata
object in your page.tsx
or layout.tsx
file. This is suitable when the metadata values are static and don’t require any dynamic processing.
Example:
generateMetadata
in your page.tsx
or layout.tsx
file. This function receives the route parameters as an argument and returns a Promise<Metadata>
. Use this approach when you need to fetch data or perform dynamic operations before returning the metadata.
Example:
generateMetadata
function receives the slug
parameter from the route, fetches the corresponding page data using the getPage
function, and returns the metadata object based on the fetched data.