Adding missing templates.

This commit is contained in:
sergiotarxz 2023-05-03 05:32:55 +02:00
parent 45a3f84987
commit 17a65364a0
2 changed files with 43 additions and 0 deletions

View File

@ -0,0 +1,25 @@
% my $posts = stash 'posts';
<h2>Artículos</h2>
<div class="articles">
% unless (defined $posts && @$posts) {
<p>Parece que aun no hay artículos.</p>
% }
% for my $post (@$posts) {
<a href="/posts/<%=$post->{slug}%>">
<article><%
my $date_article = DateTime::Format::ISO8601->parse_datetime($post->{date});
$date_article->set_time_zone('Europe/Madrid');
%><p class="date"><%= ''.$date_article %></p><%
if (defined $post->{image}) {
%><img alt="Portada de <%=$post->{title}%>" src="<%=$post->{image}%>"/><%
}
%><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>
% }
</div>

View File

@ -0,0 +1,18 @@
% use Data::Dumper;
% use DateTime::Format::ISO8601;
%
% use Mojo::DOM;
% use Mojo::Util;
%
% use BurguillosInfo::Posts;
%
% my $category = stash 'category';
% my $attribute = stash 'attribute';
% my $posts = stash 'posts';
% layout 'default', current_category_slug => $category->{slug};
% title $attribute->{title};
<div class="description">
<h1><%= $attribute->{title} %></h1>
<%== $attribute->{description} %>
%= include 'page/_list_posts', posts => $posts;
</div>