Frontmatter ఉపయోగించడం
MDX ఫైల్లలో frontmatter ఎలా ఉపయోగించాలో తెలుసుకోండి.
frontmatter అనేది MDX ఫైల్లో ముఖ్యమైన భాగం. ఫైల్లోని కంటెంట్ గురించి title, description, author, publication date వంటి సమాచారాన్ని నిర్వచించడానికి ఇది ఉపయోగించబడుతుంది.
మెటాడేటా హెడర్ ఫైల్ ప్రారంభంలో, ప్రారంభం మరియు ముగింపులో --- (మూడు hyphens) మధ్య నిర్వచించబడుతుంది.
ఫార్మాట్
మెటాడేటా హెడర్ key-value ఫార్మాట్లో నిర్వచించబడుతుంది; key అంటే మెటాడేటా పేరు, value అంటే ఆ మెటాడేటా యొక్క కంటెంట్.
ఉదాహరణ:
---
title: Document title
description: Document description
---పత్ర రకాన్ని బట్టి (documentation, blog post మొదలైనవి), వేర్వేరు మెటాడేటా ఉపయోగించవచ్చు.
డాక్యుమెంటేషన్ కోసం మెటాడేటా
titledescriptionlinkssourcedocsblogapi
ఉదాహరణ:
---
title: Document title
description: Document description
links:
source: https://google.com
docs: /docs
blog: /blog
api: https://google.com
---బ్లాగ్ పోస్టుల కోసం మెటాడేటా
author_id
ఇది post author యొక్క identifier.
ఇది src/config/blog.ts ఫైల్లో నిర్వచించిన author id తో సరిపోవాలి,
ఆ ఫైల్లో authors యొక్క పూర్తి data ఉంటుంది.
og_image
మీరు స్వయంచాలకంగా generated image ఉపయోగించకూడదనుకుంటే, social media లో share చేసినప్పుడు post featured image గా ఉపయోగించబడేది ఇదే.
Images public/blog-og ఫోల్డర్లో నిల్వ చేయాలి.
image file name మరియు extension మాత్రమే ఉపయోగించండి.
titleexcerptdateauthor_idog_imagetagslinkssourcedocsblogapi
ఉదాహరణ:
---
title: Post title
date: 2024-08-07 22:33:00
excerpt: Post excerpt
author_id: daltonmenezes
og_image: introducing-blogs-og.jpg
links:
source: https://google.com
docs: /docs
blog: /blog
api: https://google.com
tags: [next.js, open-graph, blog]
---