Skip to content

Default CombineFrontmatter renames short keys to longer, unrelated standard fields: id → video, key → keywords, list → unlisted, seo → description_seo #177

Description

@matt-edmondson

What's wrong

NameStandardizer.FindStandardPropertyMatch (Frontmatter/NameStandardizer.cs:116) accepts a containment match in both directions. One direction is the reverse case, normalizedStandard.Contains(normalizedKey). Because of it, any key that is a substring of a name in StandardOrder.PropertyNames gets renamed to that standard name.

This happens under the default options (Standard naming, Conservative merge), and it happens even when no other key in the document claims the standard name.

Reproduction (HEAD 43a9cdc)

Running the default overload, CombineFrontmatter($"---\n{k}: v\n---\nB\n"), gives these renames:

Key Becomes
id video
key keywords
list unlisted
seo description_seo
order nav_order
nav nav_order
source resource
ref references
og og_image
twitter twitter_card
class classes
script scripts

A nested Jekyll-SEO style block seo: {title: S, description: D} comes out as description_seo: {title: S, description: D}.

Why it matters

id, key, order, source and seo are very common frontmatter keys. After these renames, a site generator reads the page's id as a video value, or reads list: false as the boolean unlisted. The original key is gone, and nothing warns the user.

#162 covers the opposite direction: a standard name contained in a longer key (author_email → author). Its acceptance criteria don't include this direction, so a fix for #162 alone would leave this bug in place.

Suggested fix / acceptance criteria

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions