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;
|
|
|
|
%
|
2023-05-09 03:20:23 +02:00
|
|
|
% use OwlcodeTech::Posts;
|
|
|
|
% use OwlcodeTech::Categories;
|
|
|
|
% my $categories = OwlcodeTech::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};
|
2023-05-17 07:26:46 +02:00
|
|
|
<div id="first-box" class="description margin">
|
2023-05-18 08:47:25 +02:00
|
|
|
% if (defined $post->{image}) {
|
|
|
|
<div class="title-image">
|
|
|
|
<img alt="Portada del artículo: <%= $post->{title} %>" src="<%=$post->{image}%>"/>
|
|
|
|
<div class="text-title">
|
|
|
|
<h1><%== $post->{title} %></h1>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
% } else {
|
2023-05-03 02:37:03 +02:00
|
|
|
<h1><%= $post->{title} %></h1>
|
2023-05-18 08:47:25 +02:00
|
|
|
% }
|
2022-11-13 02:22:31 +01:00
|
|
|
% my $user_agent = stash 'useragent';
|
|
|
|
% if ($user_agent !~ /LinkedInBot/) {
|
2023-05-19 06:42:17 +02:00
|
|
|
<div class="padding-side">
|
2023-05-18 08:47:25 +02:00
|
|
|
<%== $post->{content} %>
|
|
|
|
</div>
|
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');
|
2023-05-19 06:42:17 +02:00
|
|
|
<div class="padding-side author-text">
|
|
|
|
<span>Author: <b><%= $post->{author} %></b></span>
|
|
|
|
</div>
|
|
|
|
<div class="padding-side author-text">
|
|
|
|
<span>Fecha: <b><%= $date_article %></b>.<span>
|
2023-05-19 06:34:05 +02:00
|
|
|
</div>
|
2022-11-09 13:31:58 +01:00
|
|
|
</div>
|