$] >= 5.038, 'warnings', qw[experimental::signatures experimental::class];
use Template;
use JSON;
use Path::Tiny;
use File::Find;
use File::Basename;
use FindBin '$Bin';
use File::Shar
e;
use App::LinkSite::Link;
use App::LinkSite::Social;
field $file :reader :param = 'links.json';
# Where to look for the templates.
# If we've been installed from CPAN, then File::Share::d
eld $site :reader :param = undef;
field $tt;
ADJUST {
my $json = path($file)->slurp;
my $data = JSON->new->decode($json);
$ga4 = $data->{ga4} // '';
$tt = Template->new({
17';
use strict;
use warnings;
no if $] >= 5.038, 'warnings', 'experimental::class';
use JSON;
field $name :reader :param;
field $handle :reader :param;
field $image :reader :param;
d $links :reader :param = [];
=head1 METHODS
=head2 json_ld
Returns a JSON/LD fragment for this web site.
=cut
method json_ld {
my $json = {
'@context' => 'https://schema.org',
},
relatedLink => [ map { $_->link } $self->links->@* ],
};
return JSON->new->pretty->encode($json);
}
}
1;
=head1 AUTHOR
Dave Cross <dave@davecross.co.uk>
=head1 COPYRIGHT AND