⊗jsnxPmLtSCM 36 of 57 menu

Static Metadata Passing from Content in NextJS

Let's now learn how to set custom metadata for each URL. To do this, the object with metadata needs to be exported from the file with the site content.

Let's see how this is done. Suppose we have some component with site content:

export default function Test() { return <h1>test component</h1>; }

Let's set the metadata for the URL corresponding to our content file:

export const metadata = { title: 'My Test page', description: 'Description for test page.', } export default function Test() { return <h1>test component</h1>; }

Create three pages on your site: /about, /price, /contacts. Add some text on these pages. Create custom metadata for each page.

English
AfrikaansAzərbaycanБългарскиবাংলাБеларускаяČeštinaDanskDeutschΕλληνικάEspañolEestiSuomiFrançaisहिन्दीMagyarՀայերենIndonesiaItaliano日本語ქართულიҚазақ한국어КыргызчаLietuviųLatviešuМакедонскиMelayuမြန်မာNederlandsNorskPolskiPortuguêsRomânăРусскийසිංහලSlovenčinaSlovenščinaShqipСрпскиSrpskiSvenskaKiswahiliТоҷикӣไทยTürkmenTürkçeЎзбекOʻzbekTiếng Việt
We use cookies for website operation, analytics, and personalization. Data processing is carried out in accordance with the Privacy Policy.
accept all customize decline