Image front matter in pages
Hi,
Why is the "image" front matter variable ignored in simple pages? The og:image metadata is very useful for "articles" too!
Hey! That's a great question! The technical answer is that the image front matter property is just part of the blog post schema. The real answer is simply that I haven't thought about it! But that's for sure something we should have so let's add this to the backlog!
In the meantime, I would recommend that you publish the base Markdown page template (or whichever type you want to use this for) and implement this in your project as this can still be done in userland while we wait for this to be implemented. Feel free to make a PR to the v2 branch if you want of course! Thanks again for suggesting this! 🙌
this can still be done in userland
How? Is it possible to read data from the front matter in the templates? Thanks!
this can still be done in userland
How? Is it possible to read data from the front matter in the templates? Thanks!
Yes! This is really easy, from Blade templates you always have access to the global $page variable (which you can also @dd()) and from there you can use $page->matter('key') to access any arbitrary front matter data!
Can be implemented similarly to https://github.com/hydephp/develop/pull/1884
I'm applying to address the issue where the image front matter variable is currently ignored in simple pages, even though it's valuable for Open Graph metadata like og:image. Why I'm a Great Fit I write clean, maintainable code and back changes with thoughtful testing and documentation. I’d be excited to bring this improvement to your project and help make simple pages as rich and sharable as articles.
Amazing @Kidad3grt! I've assigned you to this task so you can get right on working on this whenever it suits you. Here are the Contribution Guidelines which contain important practical information on how to set up the hydephp/develop where you'll submit your pull request.
When you're ready for your submission to be reviewed, please change your PR from "draft" to "ready for review" and request a review from me. Remember to add tests!
Let me know if you have any questions, and have an amazing time with HydePHP! 🥳