-
-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Write a YAML schema for all the currently supported front matter properties for blog posts #258
Comments
Had a random thought, what if we could write schemas as traits? That way the properties could be strongly typed and directly enforced. This way they are already semantic, and always up to date compared to documentation. And the front matter when accessed could merge those properties into the matter array at runtime. For example: class MarkdownPost
{
use FrontMatter\BlogPostSchema;
} |
Forgot the schema is actually documented, so this is gonna be a lot easier https://hydephp.com/docs/master/blog-posts#supported-front-matter-properties |
Maybe also add a note that the slug/identifier is reserved by Hyde and cannot be overridden by front matter |
Thinking a bit on how I want to handle these. On one hand, I like the idea of having these traits to only house data like follows (with comments removed for brevity) trait BlogPostSchema
{
public string $title;
public ?string $description = null;
public ?string $category = null;
public ?DateString $date = null;
public ?Author $author = null;
public ?Image $image = null;
} But being able to construct and configure the data right there would be nice, at least when developing, so I'll try that. |
Also want schema for general pages to include the common shared data and any meta tags and opengraph tags. The whole point of this change is to make it clear to users and developers what data is accessible and where it is generated from. |
Upside is also that it should be easy enough to write a parser that automatically makes changes to the docs based on the actual schema being used (not that that will be an issue later on in v1 as a schema change is probably breaking) |
No description provided.
The text was updated successfully, but these errors were encountered: