Skip to content

Commit

Permalink
Added more JSON-LD to works and productions
Browse files Browse the repository at this point in the history
  • Loading branch information
davorg committed May 2, 2019
1 parent 17a7bc9 commit e7af0d9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 4 additions & 1 deletion lib/Literature/Schema/Result/Production.pm
Expand Up @@ -177,7 +177,10 @@ sub json_ld_type {
}

sub json_ld_fields {
return [ { name => 'title' } ];
return [
{ name => 'title' },
{ productionCompany => 'made_by' },
];
}

around title => sub {
Expand Down
6 changes: 5 additions & 1 deletion lib/Literature/Schema/Result/Work.pm
Expand Up @@ -223,7 +223,11 @@ with 'Literature::Role::HasSlug', 'MooX::Role::JSON_LD';
sub slug_cols { return qw[title]; }

sub json_ld_type { $_[0]->type }
sub json_ld_fields { [ { name => 'title' } ] }
sub json_ld_fields { [
{ name => 'title' },
{ datePublished => sub { $_[0]->published ?
$_[0]->published->strftime('%Y-%m-%d') : undef } },
] }

sub asins {
my $self = shift;
Expand Down

0 comments on commit e7af0d9

Please sign in to comment.