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;
|
|
|
|
%
|
|
|
|
% layout 'default', current_slug => $current_category->{slug};
|
|
|
|
% title $current_category->{title};
|
|
|
|
<div class="description">
|
|
|
|
<h2><%= $current_category->{title} %></h2>
|
|
|
|
<%== $current_category->{description} %>
|
|
|
|
<h3>Artículos</h3>
|
|
|
|
<div class="articles">
|
|
|
|
% my ($cached_posts_by_category) = BurguillosInfo::Posts->new->Retrieve;
|
|
|
|
% my $category_post = $cached_posts_by_category->{$current_category->{slug}};
|
|
|
|
% if (defined $category_post) {
|
|
|
|
% for my $post (@$category_post) {
|
|
|
|
<a href="/posts/<%=$post->{slug}%>">
|
|
|
|
<article>
|
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 class="date"><%= ''.$date_article %></p>
|
2022-11-09 13:31:58 +01:00
|
|
|
<h4><%=$post->{title}%></h4>
|
|
|
|
% my $xml = Mojo::DOM->new($post->{content});
|
|
|
|
% my $text = $xml->all_text;
|
|
|
|
% if (length($text) > 120) {
|
|
|
|
% $text = substr($text, 0, 100).'...';
|
|
|
|
% }
|
|
|
|
<p><%=$text%></p>
|
|
|
|
<p class="author">Escrito por <%=$post->{author}%></p>
|
|
|
|
</article>
|
|
|
|
</a>
|
|
|
|
% }
|
|
|
|
% } else {
|
|
|
|
<p>Parece que aun no hay artículos.</p>
|
|
|
|
% }
|
2022-11-10 10:49:53 +01:00
|
|
|
|
2022-11-11 02:40:52 +01:00
|
|
|
</div>
|
|
|
|
<h3>Suscribete a esta categoría.</h3>
|
2022-11-10 10:49:53 +01:00
|
|
|
|
2022-11-11 02:40:52 +01:00
|
|
|
<a class="suscribe-category-rss" href="/<%=$current_category->{slug}%>.rss">
|
|
|
|
<img src="/img/rss.svg" alt="Icono de suscripción rss"/>
|
|
|
|
</a>
|
|
|
|
</div>
|