owlcode.tech/templates/page/post.html.ep

48 lines
1.6 KiB
Plaintext

% use DateTime::Format::ISO8601;
%
% use Mojo::DOM;
% use Mojo::Util;
%
% use OwlcodeTech::Posts;
% use OwlcodeTech::Categories;
% my $categories = OwlcodeTech::Categories->new->Retrieve;
% my $description_og = '<div>'.$post->{content}.'</div>';
% $description_og = Mojo::DOM->new($description_og)->all_text;
% my $base_url = config 'base_url';
% layout 'default', current_category_slug => $current_category->{slug}, categories => $categories, description_og => $description_og, ogimage => "$base_url/posts/$post->{slug}-preview.png?v=4";
% title $post->{title};
<div id="first-box" class="description margin">
% 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 {
<h1><%= $post->{title} %></h1>
% }
% my $user_agent = stash 'useragent';
% if ($user_agent !~ /LinkedInBot/) {
<div class="padding-side">
<%== $post->{content} %>
</div>
% } 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() %>
% }
% my $date_article = DateTime::Format::ISO8601->parse_datetime($post->{date});
% $date_article->set_time_zone('Europe/Madrid');
<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>
</div>
</div>