[ ] Conifer should include a trait, Conifer\Schema\HasStructuredDataMarkup, that requires the including class to implement a ::schema_markup() method which returns an array. The trait itself should implement ::json_ld() which calls ::schema_markup() and returns the JSON-serialized schema data.
[ ] Implement and document the minimum set of schemas to support, e.g. Article.
[ ] Document how to extend implement your own schemas, e.g. Event.
Possible usage:
namespace Project\Post;
use Conifer\Post\Post;
use Conifer\Schema\HasStructureDataMarkup;
class Event extends Post {
use HasStructuredDataMarkup;
const POST_TYPE = 'event';
protected function schema_markup() : array {
return [
'@type' => 'Event',
'headline' => $this->title(),
// ...
];
}
}
In the future, we may look at enhancing the trait with other microformats, although there probably isn't a big advantage there.
As a Conifer dev user, I want to be able to output schema markup for posts as JSON-LD data. Something like:
Acceptance Criteria
Conifer\Schema\HasStructuredDataMarkup
, that requires the including class to implement a::schema_markup()
method which returns an array. The trait itself should implement::json_ld()
which calls::schema_markup()
and returns the JSON-serialized schema data.Possible usage:
In the future, we may look at enhancing the trait with other microformats, although there probably isn't a big advantage there.