Skip to content

Fix invalid YAML escape sequence in wikilinks with aliases#746

Open
recursivefaults wants to merge 1 commit intooleeskild:mainfrom
recursivefaults:fix/yaml-escape-sequence-in-wikilinks
Open

Fix invalid YAML escape sequence in wikilinks with aliases#746
recursivefaults wants to merge 1 commit intooleeskild:mainfrom
recursivefaults:fix/yaml-escape-sequence-in-wikilinks

Conversation

@recursivefaults
Copy link

@recursivefaults recursivefaults commented Jan 30, 2026

In front matter, wikilinks with aliases were being output as [[path|alias]] with an escaped pipe character. This caused YAML parsing errors in Eleventy because | is not a valid escape sequence in JSON/YAML strings.

Background
Right now, digital-garden doesn't have any SEO friendly meta tags or open graph tags. I've customized my template to include that, which requires custom front matter on my notes. This also, then, requires me to pass front matter through. Builds were failing due to the plugin not being able to parse links in the front matter.

A future change could be to include SEO based fields and a robots.txt as a part of the plugin configuration, but that is a lot bigger of a change than this.

Fix
Changed to use plain pipe [[path|alias]] which:

  • Produces valid YAML frontmatter
  • Works with the site template's split("|") link parsing
  • Matches how the plugin already parses incoming wikilinks

Added comprehensive tests:

  • FrontmatterCompiler tests for YAML validity
  • GardenPageCompiler tests for wikilink conversion
  • Integration tests using the test vault

Wikilinks with aliases were being output as [[path\|alias]] with an
escaped pipe character. This caused YAML parsing errors in Eleventy
because \| is not a valid escape sequence in JSON/YAML strings.

Changed to use plain pipe [[path|alias]] which:
- Produces valid YAML frontmatter
- Works with the site template's split("|") link parsing
- Matches how the plugin already parses incoming wikilinks

Added comprehensive tests:
- FrontmatterCompiler tests for YAML validity
- GardenPageCompiler tests for wikilink conversion
- Integration tests using the test vault

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant