डॉक्सDocumentationMdxFrontmatter

Frontmatter

MDX files में frontmatter का उपयोग करना सीखें।

Frontmatter किसी MDX file का महत्वपूर्ण हिस्सा होता है। इसका उपयोग file की सामग्री से जुड़ी जानकारी define करने के लिए किया जाता है, जैसे title, description, author, publication date आदि।

Metadata header file की शुरुआत में --- (तीन hyphens) के बीच define किया जाता है।

Format

Metadata header key-value format में define होता है, जहां key metadata का नाम होती है और value metadata की सामग्री होती है।

Example:

---
title: Document title
description: Document description
---

Document के type (documentation, blog post आदि) के आधार पर अलग-अलग metadata इस्तेमाल किया जा सकता है।

Documentation के लिए metadata

  • title
  • description
  • links
    • source
    • docs
    • blog
    • api

Example:

---
title: Document title
description: Document description
links:
  source: https://google.com
  docs: /docs
  blog: /blog
  api: https://google.com
---

Blog posts के लिए metadata

  • title
  • excerpt
  • date
  • author_id
  • og_image
  • tags
  • links
    • source
    • docs
    • blog
    • api

Example:

---
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]
---