Use unique <meta> tags for single message view; change status to 404 if page is not found

This commit is contained in:
swagg boi 2022-04-08 14:17:23 -04:00
parent 6e534d1fb4
commit d27945b2b3
3 changed files with 50 additions and 1 deletions

View file

@ -135,6 +135,8 @@ group {
? $c->message->get_posts($this_page) ? $c->message->get_posts($this_page)
: $c->message->get_spam($this_page); : $c->message->get_spam($this_page);
$c->stash(status => 404) unless @$view_posts[0];
$c->stash( $c->stash(
view_posts => $view_posts, view_posts => $view_posts,
this_page => $this_page, this_page => $this_page,

View file

@ -0,0 +1,47 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta property="og:locale" content="en_US">
<meta property="og:type" content="website">
<meta property="og:title" content="Swagg::Net::Guestbook - <%= title %>">
<meta property="og:description" content="<%= @$view_post[2] %>">
<meta property="og:url" content="<%= $this_url %>">
<meta property="og:site_name" content="Swagg::Net::Guestbook">
<meta name="twitter:title" content="Swagg::Net::Guestbook - <%= title %>">
<meta name="twitter:description" content="<%= @$view_post[2] %>">
<meta name="twitter:creator" content="@swaggboi@eattherich.club">
<meta name="twitter:site" content="@swaggboi@eattherich.club">
<meta content="<%= @$view_post[2] %>" name="description">
<title>Swagg::Net::Guestbook - <%= title %></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<%= asset 'swagg.css' %>
</head>
<body>
<div class="outer">
<h1 id="top">Swagg::Net::Guestbook</h1>
<nav>
<%= link_to View => '/view' %>
<%= link_to Sign => '/sign' %>
<%= link_to Home => 'https://www.swagg.net' %>
</nav>
<% if (flash 'error') { =%>
<div class="error">
<h2>Stop! You've violated the law:</h2>
<p><%= flash 'error' %></p>
<p>Please report to the
<%= link_to 'cyber police', 'mailto:swaggboi@slackware.uk' %>!</p>
</div>
<% } =%>
<hr>
</div>
<div class="inner">
<%= content =%>
</div>
<div class="outer">
<footer>
<p><%= $post_count %> of <%= $visitor_count %> total visitors have
signed the guestbook to date.</p>
</footer>
</div>
</body>
</html>

View file

@ -1,4 +1,4 @@
% layout 'default'; % layout 'single_message';
% title 'View'; % title 'View';
<h2>Messages from the World Wide Web</h2> <h2>Messages from the World Wide Web</h2>
<% if (@$view_post[0]) { =%> <% if (@$view_post[0]) { =%>