vscode-front-matter
vscode-front-matter copied to clipboard
Enhancement: Enable custom sorting on integer fields
Is your feature request related to a problem? Please describe.
I'm trying to define a custom sorting option for my content, which logically follows weights by folder and subfolder. Unfortunately, the only valid options for type
in frontMatter.content.sorting
seem to be date
and string
. This definition is invalid:
Describe the solution you'd like
I would like for this definition to be valid and order my content by weight from lowest integer value to highest:
"frontMatter.content.sorting": [
{
"id": "byWeight",
"title": "By Weight",
"name": "weight",
"order": "asc",
"type": "integer"
}
]
Describe alternatives you've considered
I can't think of any, since Front Matter isn't aware of how my static site generator will eventually order my content.
Additional context
N/A
Support has been added. Type should be number
as this is how it was already internally implemented for other fields.
Good news and bad news - good news, the sorting works! Bad news, the configuration file still thinks number
is an invalid value.
That's great news.
The JSON schema has not yet been updated, that happens when an update to the docs happens. This is why you still see the warning.
Okay, gotcha! That makes sense to me. Thank you so much for this improvement!
A new schema version was released on the beta docs, which should fix the schema issue.
I updated to the latest version (according to VS Code, anyway - v8.1.3035820
) but no luck.
To what URL is the schema set in your frontmatter.json
file? Probably https://frontmatter.codes/frontmatter.schema.json
? The beta schema is available on: https://beta.frontmatter.codes/frontmatter.schema.json
, in some cases it might even get cached.
Yup! That fixed it for me! 😊 I'll leave it on beta since I'm almost certainly going to stay out on the edge like this 😅