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
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 inStandardOrder.PropertyNamesgets 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:idvideokeykeywordslistunlistedseodescription_seoordernav_ordernavnav_ordersourceresourcerefreferencesogog_imagetwittertwitter_cardclassclassesscriptscriptsA nested Jekyll-SEO style block
seo: {title: S, description: D}comes out asdescription_seo: {title: S, description: D}.Why it matters
id,key,order,sourceandseoare very common frontmatter keys. After these renames, a site generator reads the page'sidas avideovalue, or readslist: falseas the booleanunlisted. 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
standard ⊃ keydirection inFindStandardPropertyMatch, or allow it only when the extra part of the standard name is known decoration. Explicit known mappings, such asexcerpt → description, stay as they are.CombineFrontmatterunchanged. The fix can be combined with Default Standard naming renames compound keys to a different field:author_email→author,previous_version→version#162, which is in the same method.