دستاویزاتDocumentationMdxFrontmatter

Frontmatter

MDX files میں frontmatter استعمال کرنا سیکھیں۔

Frontmatter ایک MDX file کا اہم حصہ ہے۔ یہ file کے content کے بارے میں information define کرنے کے لیے استعمال ہوتا ہے، جیسے title، description، author، publication date وغیرہ۔

Metadata header file کے آغاز میں --- (تین hyphens) کے درمیان define کیا جاتا ہے۔

Format

Metadata header key-value format میں define ہوتا ہے، جہاں key metadata کا name اور value metadata کا content ہوتی ہے۔

مثال:

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

Document کی type (documentation، blog post وغیرہ) کے مطابق مختلف metadata استعمال کیا جا سکتا ہے۔

Documentation کے لیے metadata

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

مثال:

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

مثال:

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