2023-10-27 23:03:32 -04:00
|
|
|
% layout 'default';
|
2023-12-10 21:29:01 -05:00
|
|
|
% title scalar @{$search_results} ? 'Search Results' : 'Search';
|
2023-10-27 23:16:47 -04:00
|
|
|
<% content_for open_graph => begin %>
|
|
|
|
<meta property="og:type" content="website">
|
|
|
|
<meta property="og:title" content="<%= title %>">
|
|
|
|
<meta property="og:description" content="Search for posts.">
|
|
|
|
<% end %>
|
|
|
|
<% content_for twitter_card => begin %>
|
|
|
|
<meta name="twitter:title" content="<%= title %>">
|
|
|
|
<meta name="twitter:description" content="Search for posts.">
|
|
|
|
<% end %>
|
2023-10-27 23:03:32 -04:00
|
|
|
<h2 class="page-title"><%= title %></h2>
|
|
|
|
<% if (scalar @{$search_results}) { =%>
|
|
|
|
<main class="pager" id="results">
|
|
|
|
<% for my $result (@{$search_results}) { =%>
|
|
|
|
<article class="post">
|
|
|
|
<h4 class="post__title">
|
|
|
|
<span>
|
|
|
|
<%= $result->{'post_date'} %>
|
|
|
|
</span>
|
|
|
|
<% if ($result->{'post_type'} eq 'thread') { =%>
|
|
|
|
<%= link_to "#$result->{'post_id'}", single_thread =>
|
|
|
|
{thread_id => $result->{'post_id'}}, (class => 'post__id') %>
|
|
|
|
<% } else { =%>
|
|
|
|
<%= link_to "#$result->{'post_id'}", single_remark =>
|
|
|
|
{remark_id => $result->{'post_id'}}, (class => 'post__id') %>
|
|
|
|
<% } =%>
|
|
|
|
</h4>
|
|
|
|
<h5 class="post__author"><%= $result->{'post_author'} %></h5>
|
2023-12-10 21:29:01 -05:00
|
|
|
<% if (299 < length $result->{'post_body'}) { =%>
|
|
|
|
<details class="post__body">
|
|
|
|
<summary>
|
|
|
|
<%= truncate_text $result->{'post_body'} %>
|
|
|
|
</summary>
|
|
|
|
<%== markdown $result->{'post_body'} =%>
|
|
|
|
</details>
|
|
|
|
<% } else { =%>
|
2023-10-27 23:03:32 -04:00
|
|
|
<div class="post__body">
|
2023-12-10 21:29:01 -05:00
|
|
|
<%== markdown $result->{'post_body'} =%>
|
2023-10-27 23:03:32 -04:00
|
|
|
</div>
|
2023-12-10 21:29:01 -05:00
|
|
|
<% } =%>
|
2023-10-27 23:03:32 -04:00
|
|
|
</article>
|
|
|
|
<% } =%>
|
|
|
|
<% if ($last_page && $last_page != 1) { =%>
|
|
|
|
<nav class="pager__nav">
|
|
|
|
<%= pagination $this_page, $last_page,
|
|
|
|
($base_path . '&page={page}#results') %>
|
|
|
|
</nav>
|
|
|
|
<% } =%>
|
|
|
|
</main>
|
|
|
|
<% } =%>
|