Hacking Obsidian: Frontmatter and Templater

[[3. Resources/Readwise/Full Document Contents/Articles/Hacking Obsidian Frontmatter and Templater|Full Document Contents]]
## Document Notes
---
tags:
- #obsidian
- #templater
- #frontmatter
Author: TfTHacker
Source: Medium article
Reference: https://medium.com/obsidian-observer/hacking-obsidian-frontmatter-and-templater-f4912a689cdc
date created: {{date:YYYY-MM-DD}} {{time:HH:mm}}
---
# Title: Hacking Obsidian: Frontmatter and Templater
## Table of Contents:
- 📝 Summary (#-📝-summary)
- 📖 Main Content (#-📖-main-content)
- 🗒️ Notes (#-🗒️-notes)
- 📖 References (#-📖-references)
- 🗣️ Paraphrase (#-🗣️-paraphrase)
- 📰 Newsletter (#-📰-newsletter)
- ✅ Action Items (#-✅-action-items)
- 🧪 Hypotheses (#-🧪-hypotheses)
- 📊 Methodology (#-📊-methodology)
- ❓ Questions (#-❓-questions)
- 🔮 Future Research (#-🔮-future-research)
- 💡 Implications (#-💡-implications)
- 🧠 Learning Styles Assessment (#-🧠-learning-styles-assessment)
- 📊 Accessibility Assessment (#-📊-accessibility-assessment)
- 🌍 DEIB Assessment (#-🌍-deib-diversity-equity-inclusion-and-belonging-assessment)
- ✅ Logical validity (#-✅-logical-validity)
- 🔍 DARVO Analysis Prompt (#-🔍-darvo-analysis-prompt)
- 🔍 SEO Evaluation (#-🔍-seo-evaluation)
- 🎯 Conclusion (#-🎯-conclusion)
### References:
- TfTHacker, “Hacking Obsidian: Frontmatter and Templater,” Medium, 2023-05-25. https://medium.com/obsidian-observer/hacking-obsidian-frontmatter-and-templater-f4912a689cdc
## 📝 Summary:
The article explains a simple, practical hack to prevent Obsidian and other plugins from interpreting frontmatter contained within Templater templates as real metadata. Instead of using the standard triple-dash YAML delimiters (---), you wrap those dashes inside Templater evaluation tags <% and %>. This keeps the “frontmatter” inert while the file is a template so it doesn’t pollute search, metadata panels, or other plugin logic. When the template is executed, Templater removes the <% %> wrappers and outputs valid YAML frontmatter in the newly created note.
Key idea quoted: “To prevent Obsidian from detecting metadata in a template... use a <% at the beginning and a %> at the end of the line... The <% and %> commands are only interpreted by Templater... Obsidian treats the information as regular text instead of frontmatter.”
## 📖 Main Content:
The problem:
- Templates in Obsidian are blueprints used to keep notes consistent for recurring types (meetings, articles, flashcards, languages).
- Many users employ the Templater plugin to create advanced, dynamic templates.
- Issue: If a template contains YAML frontmatter demarcated by --- at the top, Obsidian and other plugins may read it as real metadata. That can cause:
- Template files appearing in metadata queries.
- Incorrect counts in dashboards.
- Unwanted fields polluting global metadata.
The hack:
- Replace leading and trailing YAML delimiters (---) with Templater tags: `<% --- %>` at the start and `<% --- %>` at the end of the frontmatter block.
- Why it works:
- Obsidian recognizes frontmatter only when it encounters standalone triple dashes at the very top.
- Wrapping the dashes in `<% %>` prevents Obsidian from seeing actual raw `---`. It’s treated as plain text during template storage.
- When you instantiate the template, Templater evaluates and removes the `<% %>`, leaving real `---` so the new note has valid frontmatter.
Practical example:
- A flashcard template with fields like:
- type: flashcard
- subType: language
- Keep those fields inside the pseudo-frontmatter (delimited by `<% --- %>` and `<% --- %>`) to avoid metadata bleed in the template file.
- On use, the resulting note contains valid YAML at the top, enabling downstream plugins to function correctly on actual notes only.
Considerations:
- This is a pragmatic workaround rather than a core feature toggle.
- It preserves template readability and keeps metadata logic clean across your vault.
### 🗒️ Notes
- Templates in Obsidian
- Speed up note creation; ensure consistency.
- Common for meetings, articles, personal info, flashcards.
- Templater plugin
- Enables advanced templating, dynamic fields, and logic.
- Frontmatter basics
- YAML block at the top of a note, between `---` lines.
- Used by Obsidian and plugins to read metadata.
- Problem statement
- Templates with `---` can be misread as real notes’ metadata.
- Side effects: query pollution, dashboard noise, incorrect filters.
- The `<% --- %>` solution
- Use `<% --- %>` instead of raw `---` at the start.
- Use `<% --- %>` instead of raw `---` at the end.
- Obsidian treats content as plain text in the template file.
- On insertion, Templater removes `<% %>`, produces valid YAML.
- Benefits
- Clean separation: templates aren’t “real” notes to Obsidian.
- No accidental indexing of template metadata.
- Maintains proper YAML in instantiated notes.
- Scope and limitations
- Requires Templater processing to realize valid frontmatter.
- If template file is opened without applying Templater, the “frontmatter” won’t be active.
## 📖 References:
- TfTHacker. “Hacking Obsidian: Frontmatter and Templater.” https://medium.com/obsidian-observer/hacking-obsidian-frontmatter-and-templater-f4912a689cdc
## 🗣️ Paraphrase:
1) Original sense: The problem with frontmatter in templates is that Obsidian and other plugins see it as real metadata. You may not want that because templates are blueprints, not actual notes.
- Paraphrase: When you include normal YAML frontmatter in a template, Obsidian assumes it belongs to a genuine note. That misclassification can confuse plugins and queries. Since a template isn’t a finished note, you typically don’t want its fields counted as part of your vault’s live metadata.
2) Original sense: Replace the `---` fences with `<% --- %>` so Obsidian ignores them in the template. When the template is used, Templater strips the tags and restores valid YAML.
- Paraphrase: Wrap the opening and closing YAML dashes inside Templater tags. This keeps the “frontmatter” inert inside the template file. On insertion, Templater evaluates and removes the wrappers, leaving proper frontmatter in the resulting note.
## 📰 Newsletter:
This week in web dev and WordPress: a tiny-but-mighty Obsidian tip with big implications for your content workflows. If your templates use YAML frontmatter, Obsidian may treat those as real metadata—skewing dashboards and queries. The fix is delightfully simple: wrap your frontmatter fences inside Templater tags like `<% --- %> ... <% --- %>`. Obsidian ignores the template’s frontmatter, but when you create a new note, Templater outputs valid YAML. Cleaner metadata, saner searches. While you’re polishing developer docs, check recent updates across the ecosystem—Core performance improvements, new Hooks in popular plugins, and contributor sprints ramping up ahead of the next minor release. Community highlights: onboarding cohorts are open; if you’re looking to sharpen PHP/JS skills and contribute, now’s your moment. New plugins worth a look: improved site health dashboards and smarter image lazy-loading. Pro tip: apply the Obsidian trick to keep your internal knowledge base tidy while you iterate on content models. Reference: “Hacking Obsidian: Frontmatter and Templater” by TfTHacker.
## ✅ Action Items:
Strategic prompt for aligning this article with open-source advocacy, contributor engagement, and education (OSPO trajectory):
- Map to education:
- Use this technique in internal curriculum notes to prevent template metadata from polluting learning repositories.
- Create a lesson showing “data hygiene in docs” using the `<% --- %>` pattern as an example of source-of-truth preservation.
- Contributor onboarding:
- Standardize contributor issue/PR templates with “inert until instantiated” sections to prevent bots from misreading placeholders.
- Document a “template hygiene” checklist for project repos and knowledge bases.
- Open-source sustainability:
- Emphasize metadata integrity as a maintainability practice: clean dashboards → better decisions → sustainable governance.
- Encourage plugin authors to offer “ignore template metadata” options; open an RFC/model issue.
- OSPO leadership:
- Policy: define metadata conventions for docs/templates across teams (YAML fences, processing tags, validation).
- T
> [!note]+ Document Notes
> tags:
> - #obsidian
> - #templater
> - #frontmatter
> Author: TfTHacker
> Source: Medium article
> Reference: https://medium.com/obsidian-observer/hacking-obsidian-frontmatter-and-templater-f4912a689cdc
> date created: {{date:YYYY-MM-DD}} {{time:HH:mm}}
>
> # Title: Hacking Obsidian: Frontmatter and Templater
>
<!-- deep-read:sections start -->
## Table of Contents:
- 📝 Summary (#-📝-summary)
- 📖 Main Content (#-📖-main-content)
- 🗒️ Notes (#-🗒️-notes)
- 📖 References (#-📖-references)
- 🗣️ Paraphrase (#-🗣️-paraphrase)
- 📰 Newsletter (#-📰-newsletter)
- ✅ Action Items (#-✅-action-items)
- 🧪 Hypotheses (#-🧪-hypotheses)
- 📊 Methodology (#-📊-methodology)
- ❓ Questions (#-❓-questions)
- 🔮 Future Research (#-🔮-future-research)
- 💡 Implications (#-💡-implications)
- 🧠 Learning Styles Assessment (#-🧠-learning-styles-assessment)
- 📊 Accessibility Assessment (#-📊-accessibility-assessment)
- 🌍 DEIB Assessment (#-🌍-deib-diversity-equity-inclusion-and-belonging-assessment)
- ✅ Logical validity (#-✅-logical-validity)
- 🔍 DARVO Analysis Prompt (#-🔍-darvo-analysis-prompt)
- 🔍 SEO Evaluation (#-🔍-seo-evaluation)
- 🎯 Conclusion (#-🎯-conclusion)
### References:
- TfTHacker, “Hacking Obsidian: Frontmatter and Templater,” Medium, 2023-05-25. https://medium.com/obsidian-observer/hacking-obsidian-frontmatter-and-templater-f4912a689cdc
## 📝 Summary:
The article explains a simple, practical hack to prevent Obsidian and other plugins from interpreting frontmatter contained within Templater templates as real metadata. Instead of using the standard triple-dash YAML delimiters (---), you wrap those dashes inside Templater evaluation tags <% and %>. This keeps the “frontmatter” inert while the file is a template so it doesn’t pollute search, metadata panels, or other plugin logic. When the template is executed, Templater removes the <% %> wrappers and outputs valid YAML frontmatter in the newly created note.
Key idea quoted: “To prevent Obsidian from detecting metadata in a template... use a <% at the beginning and a %> at the end of the line... The <% and %> commands are only interpreted by Templater... Obsidian treats the information as regular text instead of frontmatter.”
## 📖 Main Content:
The problem:
- Templates in Obsidian are blueprints used to keep notes consistent for recurring types (meetings, articles, flashcards, languages).
- Many users employ the Templater plugin to create advanced, dynamic templates.
- Issue: If a template contains YAML frontmatter demarcated by --- at the top, Obsidian and other plugins may read it as real metadata. That can cause:
- Template files appearing in metadata queries.
- Incorrect counts in dashboards.
- Unwanted fields polluting global metadata.
The hack:
- Replace leading and trailing YAML delimiters (---) with Templater tags: `<% --- %>` at the start and `<% --- %>` at the end of the frontmatter block.
- Why it works:
- Obsidian recognizes frontmatter only when it encounters standalone triple dashes at the very top.
- Wrapping the dashes in `<% %>` prevents Obsidian from seeing actual raw `---`. It’s treated as plain text during template storage.
- When you instantiate the template, Templater evaluates and removes the `<% %>`, leaving real `---` so the new note has valid frontmatter.
Practical example:
- A flashcard template with fields like:
- type: flashcard
- subType: language
- Keep those fields inside the pseudo-frontmatter (delimited by `<% --- %>` and `<% --- %>`) to avoid metadata bleed in the template file.
- On use, the resulting note contains valid YAML at the top, enabling downstream plugins to function correctly on actual notes only.
Considerations:
- This is a pragmatic workaround rather than a core feature toggle.
- It preserves template readability and keeps metadata logic clean across your vault.
### 🗒️ Notes
- Templates in Obsidian
- Speed up note creation; ensure consistency.
- Common for meetings, articles, personal info, flashcards.
- Templater plugin
- Enables advanced templating, dynamic fields, and logic.
- Frontmatter basics
- YAML block at the top of a note, between `---` lines.
- Used by Obsidian and plugins to read metadata.
- Problem statement
- Templates with `---` can be misread as real notes’ metadata.
- Side effects: query pollution, dashboard noise, incorrect filters.
- The `<% --- %>` solution
- Use `<% --- %>` instead of raw `---` at the start.
- Use `<% --- %>` instead of raw `---` at the end.
- Obsidian treats content as plain text in the template file.
- On insertion, Templater removes `<% %>`, produces valid YAML.
- Benefits
- Clean separation: templates aren’t “real” notes to Obsidian.
- No accidental indexing of template metadata.
- Maintains proper YAML in instantiated notes.
- Scope and limitations
- Requires Templater processing to realize valid frontmatter.
- If template file is opened without applying Templater, the “frontmatter” won’t be active.
## 📖 References:
- TfTHacker. “Hacking Obsidian: Frontmatter and Templater.” https://medium.com/obsidian-observer/hacking-obsidian-frontmatter-and-templater-f4912a689cdc
## 🗣️ Paraphrase:
1) Original sense: The problem with frontmatter in templates is that Obsidian and other plugins see it as real metadata. You may not want that because templates are blueprints, not actual notes.
- Paraphrase: When you include normal YAML frontmatter in a template, Obsidian assumes it belongs to a genuine note. That misclassification can confuse plugins and queries. Since a template isn’t a finished note, you typically don’t want its fields counted as part of your vault’s live metadata.
2) Original sense: Replace the `---` fences with `<% --- %>` so Obsidian ignores them in the template. When the template is used, Templater strips the tags and restores valid YAML.
- Paraphrase: Wrap the opening and closing YAML dashes inside Templater tags. This keeps the “frontmatter” inert inside the template file. On insertion, Templater evaluates and removes the wrappers, leaving proper frontmatter in the resulting note.
## 📰 Newsletter:
This week in web dev and WordPress: a tiny-but-mighty Obsidian tip with big implications for your content workflows. If your templates use YAML frontmatter, Obsidian may treat those as real metadata—skewing dashboards and queries. The fix is delightfully simple: wrap your frontmatter fences inside Templater tags like `<% --- %> ... <% --- %>`. Obsidian ignores the template’s frontmatter, but when you create a new note, Templater outputs valid YAML. Cleaner metadata, saner searches. While you’re polishing developer docs, check recent updates across the ecosystem—Core performance improvements, new Hooks in popular plugins, and contributor sprints ramping up ahead of the next minor release. Community highlights: onboarding cohorts are open; if you’re looking to sharpen PHP/JS skills and contribute, now’s your moment. New plugins worth a look: improved site health dashboards and smarter image lazy-loading. Pro tip: apply the Obsidian trick to keep your internal knowledge base tidy while you iterate on content models. Reference: “Hacking Obsidian: Frontmatter and Templater” by TfTHacker.
## ✅ Action Items:
Strategic prompt for aligning this article with open-source advocacy, contributor engagement, and education (OSPO trajectory):
- Map to education:
- Use this technique in internal curriculum notes to prevent template metadata from polluting learning repositories.
- Create a lesson showing “data hygiene in docs” using the `<% --- %>` pattern as an example of source-of-truth preservation.
- Contributor onboarding:
- Standardize contributor issue/PR templates with “inert until instantiated” sections to prevent bots from misreading placeholders.
- Document a “template hygiene” checklist for project repos and knowledge bases.
- Open-source sustainability:
- Emphasize metadata integrity as a maintainability practice: clean dashboards → better decisions → sustainable governance.
- Encourage plugin authors to offer “ignore template metadata” options; open an RFC/model issue.
- OSPO leadership:
- Policy: define metadata conventions for docs/templates across teams (YAML fences, processing tags, validation).
- Tooling: add CI checks that flag unintended live metadata in template directories.
- Transparency & inclusivity:
- Publish contributor documentation on how templates transform into canonical artifacts.
- Provide accessible guides and examples for non-developers contributing to docs.
- WordPress ecosystem:
- Translate the pattern to WP: use block templates with placeholders and pre-processing steps to avoid surfacing draft taxonomies.
- Run workshops on content modeling and template safety in CMS and docs.
Prompt you can reuse with future articles:
“Analyze how this article’s core practices improve open-source contributor experience, metadata hygiene, and sustainable documentation workflows. Identify transferable patterns for WordPress and OSPO operations, propose onboarding materials and CI/policy changes, and outline how the practice supports transparency, inclusivity, and long-term maintainability.”
## 🧪 Hypotheses:
- H1: Using inert frontmatter in templates reduces false positives in metadata-driven queries and dashboards by ≥50%.
- H2: Teams employing this approach experience faster content discovery and fewer misfiled notes.
- H3: Clear template–note separation increases contributor confidence and adoption of standardized templates.
### 📊 Methodology:
- Data sources: Vault-level query logs, dashboard accuracy metrics, contributor surveys, PR/issue templates in repos.
- Design: A/B test teams using raw `---` vs `<% --- %>` in templates for 4–6 weeks.
- Analysis: Compare query precision/recall, count of “template pollution” incidents, and survey-based UX scores. Use interrupted time-series to account for learning effects.
### ❓ Questions:
- Where else do metadata fences create unintended side effects (CMS, static site generators, CI)?
- Could Templater or Obsidian add a “template mode” that natively ignores frontmatter?
- What governance policy best prevents accidental metadata leakage in large knowledge bases?
### 🔮 Future Research:
- Build a plugin or core feature to auto-ignore frontmatter in designated template directories.
- Investigate linting rules that detect frontmatter at non-instantiated template paths.
- Evaluate portability of this approach to other tools (Dendron, Foam, Notion exports, Jekyll/Hugo starters).
### 💡 Implications:
- Improved data integrity for dashboards and analytics.
- Lower maintenance overhead and cleaner contributor experience.
- Foundation for cross-tool metadata governance policies.
### 🧠 Learning Styles Assessment:
- Readability level: General technical audience; roughly grades 9–10 (concise, procedural).
- Visual learners:
- Present: Minimal visuals mentioned (an example image is referenced).
- Improve: Add a before/after screenshot of a template and resultant note; flowchart of processing.
- Aural learners:
- Present: None.
- Improve: Provide a short audio walkthrough or TTS summary.
- Verbal learners:
- Present: Clear explanations with concrete examples (flashcards, language subtype).
- Improve: Add analogies (e.g., “Schrödinger’s frontmatter” until instantiated).
- Kinesthetic learners:
- Present: Actionable steps are implied.
- Improve: Include a step-by-step exercise with a downloadable example template.
- Logical learners:
- Present: Cause-effect reasoning (why Obsidian misreads; how tags fix it).
- Improve: Include a decision tree for when to use inert frontmatter.
- Social learners:
- Present: Not explicit.
- Improve: Link to community forums for sharing template patterns.
- Solitary learners:
- Present: Self-paced reading.
- Improve: Add reflection prompts (“List three templates that need inert frontmatter”).
- Naturalistic learners:
- Present: Not applicable.
- Improve: Use environment analogies sparingly if helpful.
### 📊 Accessibility Assessment:
- Screen reader compatibility:
- Likely acceptable as a standard Medium article; images should have alt text.
- Improve: Ensure the example image has descriptive alt text explaining the frontmatter fields.
- Keyboard navigation:
- Medium supports basic navigation.
- Improve: Verify focus order and skip links; ensure code blocks are focusable.
- Contrast and readability:
- Medium defaults are readable.
- Improve: Ensure code samples have sufficient contrast and a monospaced font.
- Text resizing:
- Medium is responsive.
- Improve: Validate that code snippets reflow without horizontal scrolling on mobile.
### 🌍 DEIB (Diversity, Equity, Inclusion, and Belonging) Assessment:
- Cultural relevance:
- Neutral, technical topic; limited cultural scope.
- Improve: Include diverse use cases (education, non-profits, languages outside English).
- Inclusive language:
- Generally neutral and accessible.
- Improve: Define terms like “frontmatter” and “Templater” on first use for newcomers.
- Neurodiversity support:
- Short, focused content helps.
- Improve: Add headings, bullet lists, and a numbered procedure.
- Representation:
- Not applicable visually; no explicit representation.
- Improve: If adding images, prefer inclusive imagery or neutral diagrams.
- Psychological safety:
- Friendly, helpful tone.
- Improve: Encourage experimentation and provide rollback steps to reduce risk anxiety.
### ✅ Logical validity:
- Tone: Practical, instructive, tool-centric; neutral and helpful.
- Strong reasoning:
- Causal reasoning: “By not using three standalone dashes, Obsidian treats the information as regular text...” This clearly connects the cause (no raw `---`) with the effect (not parsed as frontmatter). Suggestion: Add a one-line explanation of Obsidian’s YAML detection rules to strengthen the causal link.
- Logical flow: Problem → solution → why it works → outcome. Suggestion: Include a minimal reproducible example (MRE) to further cement the flow.
- Appeal to evidence (implicit): References typical plugin behavior. Suggestion: Add links to Obsidian docs on frontmatter parsing and Templater docs for `<% %>` behavior to ground claims.
- No notable fallacies present. The article does not engage opponents or make sweeping claims.
🔍 DARVO Analysis Prompt
- Deny: Not present. The piece does not deny issues; it acknowledges a common problem with template metadata recognition.
- Attack: Not present. No disparagement of Obsidian or plugin authors; it’s constructive.
- Reverse Victim and Offender: Not present. The article frames users as problem-solvers rather than victims.
- Notes: Tone is collaborative and solutions-oriented; no emotional manipulation or rhetorical aggression detected.
### 🔍 SEO Evaluation:
- Keywords:
- Present: “Obsidian,” “Templater,” “frontmatter,” “templates,” “metadata.”
- Improve: Use variations like “YAML front matter in Obsidian,” “avoid template metadata.”
- Meta description:
- Ensure a concise summary: “Prevent Obsidian from reading template frontmatter as metadata using a simple Templater tag trick.”
- Title tag:
- Current title is clear and includes primary keywords (“Obsidian,” “Frontmatter,” “Templater”).
- Headers:
- Add H2/H3 structure: Problem, Solution, Why it Works, Example, Caveats.
- Include keywords in at least one subheading.
- Content length:
- Short and focused; could be expanded to ~1,000+ words with examples and FAQs.
- Internal/External links:
- Add links to Obsidian docs on frontmatter and Templater docs.
- URL structure:
- URL is readable and keyword-rich.
- Image optimization:
- Add descriptive alt text like “Obsidian flashcard template frontmatter example.”
- Mobile optimization:
- Medium is responsive; ensure code formatting wraps on small screens.
- User engagement:
- Add a code snippet block and a downloadable template; include a CTA to test the hack.
- Schema markup:
- Consider Article schema; add HowTo schema if steps are enumerated.
- Social sharing:
- Ensure Open Graph title/description emphasize “Templater frontmatter fix.”
## 🎯 Conclusion:
This article delivers a concise, high-impact technique for keeping Obsidian templates from polluting vault-wide metadata: wrap YAML fences in Templater tags (`<% --- %>` ... `<% --- %>`). Obsidian then ignores the template’s frontmatter, but instantiated notes still get valid YAML. The approach improves metadata hygiene, dashboard accuracy, and contributor experience—transferable to broader documentation governance and OSPO best practices.
<!-- deep-read:sections end -->
## Highlights
- Templates serve as pre-designed blueprints, streamlining the process of creating notes by eliminating the need to start from scratch every time. ([View Highlight](https://read.readwise.io/read/01h1z528sa4ajqvj9f0xr1d3vh))