Terminology & Practice

Frontmatter — Origin and Role in Vector DB Indexing

Where the term comes from, and what's actually relevant when frontmatter is used as a metadata carrier for chunking and indexing documents in a vector database.

1 Origin of the Term

From book printing through static site generators to the RAG pipeline standard
Publishing
Front Matter (book printing)
All the pages before a book's main text: title page, copyright page, table of contents, preface. Counterpart: "back matter" (appendix, index) at the end.
~2008, Jekyll
Static site generators
Jekyll adopts the term for the YAML block at the start of a file that describes title, date, layout, etc. before the content follows.
Today
General convention
Markdown, Hugo, Astro, Notion exports, skill files — and in RAG pipelines as the place for metadata attached to chunks before embedding.

Front matter is only one of three parts a book is traditionally divided into — for context:

Before
Front Matter
Title page, copyright page, table of contents, dedication, preface. Prepares the reader for the content, but isn't the content itself.
The content itself
Body Matter
The actual main text: chapters, prologue/epilogue in fiction, introduction/conclusion in non-fiction. What the book is actually about.
After
Back Matter
Supplements the main text without being part of it: appendix, glossary, bibliography, endnotes, index, acknowledgements, author bio.

2 Frontmatter in the Vector DB Context

Why the book analogy holds up here

When indexing for a vector database, a document is typically split into chunks, each chunk is embedded, and stored together with a metadata object. Frontmatter is the usual place where this metadata is declared in the source document itself — usually as a YAML block at the start of the file — instead of guessing it at runtime or deriving it from the file system.

The advantage: the metadata travels with the document, is versionable (e.g. in Git), human-readable, and can be carried over 1:1 into the vector record's metadata field during ingestion — regardless of whether Pinecone, Weaviate, Qdrant, Chroma, or pgvector serves as the backend.

Example — frontmatter of a knowledge-base source before chunking
---
title: "Enterprise Customer SLA Policy"
doc_id: "kb-2026-0341"
source: "confluence://legal-space/sla-policy"
version: "3.2"
created_at: 2025-11-04
updated_at: 2026-07-19
author: "j.doe@example-corp.com"
language: "en"
category: "legal"
tags: ["sla", "enterprise", "support"]
access_level: "internal"
---

Content of the document, which is subsequently
chunked and embedded …

3 Frontmatter Equivalents in Other File Formats

Markdown frontmatter is only the most visible variant — Word, PowerPoint, PDF, and email, for example, carry the same kind of metadata differently

In Markdown, frontmatter is purely a community-convention trick: free text that nobody mandates. Other file formats solve the same underlying need — carrying metadata independently of the visible content — through their own, sometimes even standardized, mechanisms.

In Word and PowerPoint (both in OOXML format, technically a ZIP container), the metadata lives in two internal XML files: docProps/core.xml and docProps/app.xml. Interestingly, the core properties are explicitly mapped to Dublin Core — the dc: prefix shows up there 1:1 (dc:title, dc:creator, dc:subject, dcterms:created). The user sets these fields via File → Info → Properties — but there's no automatically inserted cover page or table in the document itself; visible cover sheets with metadata fields are always manually designed templates. Freely definable extra fields (the equivalent of category or access_level) can be added via Advanced Properties → Custom.

PDFs have two parallel layers: the older Info Dictionary (Title, Author, Subject, Keywords) and XMP metadata — an embedded XML package, again based on Dublin Core.

With email, the analogy is most direct: RFC 5322 mandates a header block before a blank line, ahead of the actual body — From, To, Subject, Date, Message-ID, References. Structurally almost identical to YAML frontmatter, just without the --- delimiter. Part of it is set by the user (subject, recipient), part automatically by the mail client (date, message ID).

FormatWhere the metadata livesHow it's set
Markdown (.md) YAML block at the start of the file User writes the block directly as text
Word / PowerPoint
(.docx / .pptx)
docProps/core.xml + app.xml inside the OOXML container (Dublin Core fields) User via the Properties dialog; freely definable fields via "Custom"
PDF Info Dictionary + embedded XMP metadata package Set by the authoring application on export, editable afterwards with tools (Acrobat, ExifTool)
Email (.eml) RFC 5322 header block before a blank line Partly the user (subject, recipient), partly automatic via the mail client (date, message ID)

For the indexing pipeline, this means: for Office formats, PDFs, and emails, the parser (e.g. python-docx, python-pptx, extract-msg, Unstructured, LlamaParse, Microsoft markitdown) extracts the native metadata automatically — you don't need your own frontmatter for that. What these formats don't bring natively — category, access_level, department in the sense your pipeline needs — you still have to supply separately, e.g. via "Custom Properties" in Office files or a separate mapping table per source/folder.

4 Standard Metadata Fields

There's no binding standard — but a de facto vocabulary has emerged across common RAG frameworks (LangChain, LlamaIndex, Unstructured, Vectorize)
User provided by the user when creating or maintaining the document (frontmatter, document properties) System determined automatically by the ingestion pipeline — the processing chain that carries a document from the source into the vector DB (reading, parsing, chunking, embedding, storing) Chunking only comes into existence when splitting into chunks
Origin & Identity
FieldPurposeOrigin
doc_id / origin_idUnique ID of the source document (usually a UUID) — for updates, re-indexing, deletionSystem
source / source_uriPath or URI to the original source (file system, Confluence, S3, web URL)System
filenameOriginal file name, independent of the internal storage pathSystem
originIngestion channel, e.g. file-upload, web-crawler, confluence-syncSystem
content_hash / checksumHash of the content for deduplication and change detection (re-embedding only on diff)System
Chunk Position & Structure automatically generated
FieldPurposeOrigin
chunk_idUnique ID of the individual chunk, often {doc_id}_{index}Chunking
chunk_index / total_chunksPosition within the document, e.g. "chunk 20 of 181" — enables neighbor retrievalChunking
section / headingHeading of the section the chunk comes from (improves citability)Chunking
page_numberPage number for PDFs — important for exact source citationsChunking
start_char / end_charOffset in the original text, for highlighting or reassemblyChunking

This group deliberately doesn't belong in the frontmatter: it depends on the chosen chunk size and overlap strategy and only exists once the chunker has run — the values can change with every re-indexing run.

Time & Versioning
FieldPurposeOrigin
created_at / updated_atCreation or last-modified date of the source — for temporal filtering ("only the current version")User
ingested_atTimestamp of indexing into the vector DB (independent of the document date)System
versionDocument version, relevant when multiple versions can exist in parallelUser
embedding_modelWhich embedding model was used — important when switching or migrating modelsSystem
Classification & Access
FieldPurposeOrigin
category / typeRough classification, e.g. policy, ops, legalUser
tags[]Freely assignable keywords for fine-grained filteringUser
department / ownerOrganizational assignment, supports multi-tenant separationUser
access_level / aclPermission level (e.g. public, internal, confidential) — essential so search doesn't return content the requesting user isn't authorized to seeUser
languageLanguage code — relevant for multilingual corpora and language-specific embedding modelsUser
Modeled on Dublin Core
The dc: prefix is an XML/RDF namespace (http://purl.org/dc/elements/1.1/), needed only in XML/RDF serializations like RSS/Atom, OAI-PMH, or XMP metadata in PDFs. In a flat JSON metadata object for a vector DB, the prefix is dropped — only the conceptual level carries over, not the notation:
title (≙ dc:title)
author (≙ dc:creator)
created_at (≙ dc:date)
tags / category (≙ dc:subject)
doc_id (≙ dc:identifier)
language (≙ dc:language)
Modeled on schema.org
datePublished → created_at
dateModified → updated_at
author → author
keywords → tags
url → source_uri

5 Worth Knowing in Practice

Points that often get lost in plain field lists
Metadata inheritance: document vs. chunk level
Frontmatter usually describes the whole document. During chunking, this set is typically inherited by every chunk and extended with chunk-specific fields (chunk_id, section). Without this inheritance, you lose the link back to the source after chunking.
Keep metadata size bounded
Many vector DBs limit the metadata payload per vector (e.g. Pinecone: 40 KB per vector). Frontmatter should stay compact — long free text belongs in the chunk content, not in the metadata field.
Metadata filtering before the similarity search
The real value of structured frontmatter fields is often not in the embedding itself, but in pre-filtering: the vector search is narrowed down beforehand via a metadata filter (e.g. department = "support"), before the expensive similarity computation runs.
#
snake_case as the de facto convention
Frameworks like Vectorize, LangChain, and LlamaIndex consistently use snake_case for field names. A consistent naming convention across all sources makes later filter queries considerably easier.
No universal mandatory standard — but convergence
There's no ISO standard for RAG metadata. LangChain (Document.metadata) and LlamaIndex (Node.metadata) deliberately allow free-form dicts. In practice, though, almost all pipelines converge on the same core set: source, doc_id, chunk_id, created_at/updated_at, category/tags.