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

57 lines
2.2 KiB
Plaintext

% use Data::Dumper;
% use DateTime::Format::ISO8601;
% use Mojo::DOM;
%
% use Mojo::DOM;
% use Mojo::Util;
%
% use OwlcodeTech::Posts;
%
% my $description_og = '<div>'.$current_category->{description}.'</div>';
% my $base_url = config 'base_url';
% $description_og = Mojo::DOM->new($description_og)->all_text;
% layout 'default', current_category => $current_category, description_og => $description_og, ogimage => "$base_url/@{[$current_category->{slug}]}-preview.png";
% title $current_category->{title};
<div id="first-box" class="description margin">
% if (defined $current_category->{image}) {
<div class="title-image">
<img alt="Portada de la categoría: <%= $current_category->{title} %>" src="<%=$current_category->{image}%>"/>
<div class="text-title">
<h1><%== $current_category->{title} %></h1>
<%== $current_category->{description} %>
</div>
</div>
% } else {
<div class="padding">
<h1><%== $current_category->{title} %></h1>
<%== $current_category->{description} %>
</div>
% }
% if (defined $current_category->{extra_text}) {
<div class="padding">
<%== $current_category->{extra_text} %>
</div>
% }
<div class="content">
% my $children_categories = $current_category->{children};
% my $attributes = $current_category->{attributes};
% if (@$children_categories || %$attributes) {
<h2>Quizás te interese.</h2>
% for my $child_category (@$children_categories) {
<p><a href="/<%=$child_category->{slug}%>"><%==$child_category->{title}%></a></p>
% }
% for my $attribute_slug (keys %$attributes) {
% my $attribute = $attributes->{$attribute_slug};
<p><a href="<%="/$current_category->{slug}/atributo/$attribute->{identifier}"%>"><%==$attribute->{menu_text}%></a></p>
% }
% }
% my ($category_posts) = OwlcodeTech::Posts->new->RetrieveAllPostsForCategory($current_category->{slug});
%= include 'page/_list_posts', posts => $category_posts;
<h2>Suscribete a esta categoría.</h2>
<a class="suscribe-category-rss" href="/<%=$current_category->{slug}%>.rss">
<img src="/img/rss.svg" alt="Icono de suscripción rss"/>
</a>
</div>
</div>