⊗jsnxPmLtLM 35 of 57 menu

Metadata in the Main Site Layout in NextJS

So, in the previous lesson, we found out that there are various ways to insert metadata. The simplest one is to set them in the layout file using the following construct:

export const metadata = { title: 'Test site', description: 'This is my page description.', };

In this case, the title and meta description will change to the ones we specified. However, this approach has a significant problem. It lies in the fact that the metadata is hardcoded in the main site layout. That is, it turns out that for every URL they will be the same. This is incorrect both from the SEO perspective, and from the perspective of site usability.

Change the title in your main site layout. Check that it has changed.

Change the meta description in your main site layout. Then open the source code of the site and check that it has changed.

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