Skip to content

Commit

Permalink
add 404 Not Found page based on the content on sco. Use template for it
Browse files Browse the repository at this point in the history
  • Loading branch information
szabgab committed Oct 21, 2014
1 parent 35c3562 commit e865a6c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
5 changes: 3 additions & 2 deletions lib/MetaCPAN/SCO.pm
Expand Up @@ -27,10 +27,11 @@ sub run {

my $request = Plack::Request->new($env);
if ($request->path_info eq '/') {
return template('index');
return template('index', {front => 1});
}

return [ '404', [ 'Content-Type' => 'text/html' ], ['404 Not Found'], ];
my $reply = template('404');
return [ '404', [ 'Content-Type' => 'text/html' ], $reply->[2], ];
};

builder {
Expand Down
11 changes: 11 additions & 0 deletions tt/404.tt
@@ -0,0 +1,11 @@
<h1 class=huge>Not found</h1>
<br>
Whatever it was you were looking for, it's not here.
This may be due to...
<ul>
<li>You made a typo in the URL</li>
<li>What you are looking for no longer exists on CPAN</li>
<!-- <li>You are completely confused, which is not my fault :-)</li> -->
<li>You followed an invalid link. If this is the case, please
inform the maintainer of the <a href="/">referring page</a>
</ul>
2 changes: 1 addition & 1 deletion tt/incl/header.tt
Expand Up @@ -8,7 +8,7 @@

<link rel="stylesheet" href="http://st.pimg.net/tucs/style.css?3" />
</head>
<body id="cpansearch" onload="document.f.query.focus();" class="front">
<body id="cpansearch" onload="document.f.query.focus();" <% IF front %>class="front"<% END %>>

<div class="header">
<center><div class="logo"><a href="/"><img src="http://st.pimg.net/tucs/img/cpan_banner.png" alt="CPAN"></a></div></center>
Expand Down

0 comments on commit e865a6c

Please sign in to comment.