2022-11-11 00:05:48 +01:00
|
|
|
% use DateTime::Format::ISO8601;
|
|
|
|
%
|
2022-11-09 13:31:58 +01:00
|
|
|
% use Mojo::DOM;
|
|
|
|
% use Mojo::Util;
|
|
|
|
%
|
|
|
|
% use BurguillosInfo::Posts;
|
|
|
|
% use BurguillosInfo::Categories;
|
|
|
|
% my $categories = BurguillosInfo::Categories->new->Retrieve;
|
2023-05-03 17:17:54 +02:00
|
|
|
% my $description_og = '<div>'.$post->{content}.'</div>';
|
|
|
|
% $description_og = Mojo::DOM->new($description_og)->all_text;
|
2023-05-03 17:23:51 +02:00
|
|
|
% my $base_url = config 'base_url';
|
2023-05-04 18:57:17 +02:00
|
|
|
% layout 'default', current_category_slug => $current_category->{slug}, categories => $categories, description_og => $description_og, ogimage => "$base_url/posts/$post->{slug}-preview.png?v=4";
|
2022-11-09 13:31:58 +01:00
|
|
|
% title $post->{title};
|
|
|
|
<div class="description">
|
2023-05-03 02:37:03 +02:00
|
|
|
<h1><%= $post->{title} %></h1>
|
2022-11-13 02:22:31 +01:00
|
|
|
% my $user_agent = stash 'useragent';
|
|
|
|
% if ($user_agent !~ /LinkedInBot/) {
|
2022-11-09 13:31:58 +01:00
|
|
|
<%== $post->{content} %>
|
2022-11-13 02:22:31 +01:00
|
|
|
% } else {
|
|
|
|
% my $content = $post->{content};
|
|
|
|
% my $dom = Mojo::DOM->new($content);
|
|
|
|
% my @images = $dom->find('img')->each;
|
|
|
|
% for my $image (@images) {
|
|
|
|
% $image->remove;
|
|
|
|
% }
|
|
|
|
<%== $dom->to_string() %>
|
|
|
|
% }
|
2022-11-11 00:05:48 +01:00
|
|
|
% my $date_article = DateTime::Format::ISO8601->parse_datetime($post->{date});
|
|
|
|
% $date_article->set_time_zone('Europe/Madrid');
|
|
|
|
<p>Escrito por <%= $post->{author} %> con fecha <%= $date_article %>.<p>
|
2022-11-09 13:31:58 +01:00
|
|
|
</div>
|