App-LinkSite
view release on metacpan or search on metacpan
lib/App/LinkSite/Link.pm view on Meta::CPAN
field $title :reader :param;
field $subtitle :reader :param = '';
field $link :reader :param;
field $new_link :reader(is_new) :param(new) = 0;
=head1 METHODS
=head2 mk_link
Returns a fragment of HTML that is used to display this link on the site.
It's actually an `<li>` that wraps an `<a>`. So this method probably needs
to be renamed or refactored. Maybe it should just be called `render()`.
=cut
method mk_link {
my $a_tag = q[<a href="] . $self->link . q[" class="text-decoration-none">] . $self->title . q[</a>];
my $subtitle = $self->subtitle ? q[<br><small class="text-muted">] . $self->subtitle . q[</small>] : '';
lib/App/LinkSite/Site.pm view on Meta::CPAN
method all_links {
my @all_links = $self->links->@*;
for my $section ($self->sections->@*) {
push @all_links, $section->links->@*;
}
return @all_links;
}
=head2 json_ld
Returns a JSON/LD fragment for this web site.
=cut
method json_ld {
my $json = {
'@context' => 'https://schema.org',
'@type' => 'WebPage',
name => "Links page for $name ($handle)",
mainEntity => {
'@context' => 'https://schema.org',
lib/App/LinkSite/Social.pm view on Meta::CPAN
'ko-fi' => {
url => 'https://ko-fi.com/',
name => 'Ko-fi',
}
};
=head1 METHODS
=head2 mk_social_link
Return a fragment of HTML that is used to represent this social media link
on the link site.
=cut
method mk_social_link {
return $url if $url;
my $social_url;
if (exists $urls->{$service}) {
lib/App/LinkSite/Social.pm view on Meta::CPAN
=back
=cut
method social_icon_template {
return q[<a rel='me' title='%s' href='%s'><i class='fa-brands fa-3x fa-%s'></i></a>];
}
=head2 mk_social_icon
Returns a fragment of HTML that will be used to display the social media
account on the web site.
=cut
method mk_social_icon {
return sprintf $self->social_icon_template,
$urls->{$service}{name}, $self->mk_social_link(), $service;
}
}
( run in 1.059 second using v1.01-cache-2.11-cpan-b16cb0d3907 )