Newscoop 4 Cookbook

Making a 404 page template

Good-looking, user-friendly "404 page" templates let people know that although the page they requested can't be found, the site is still up and running correctly. Another Newscoop feature at the publication configuration level enables site developers to specify the template which will be used when readers try to load an invalid URL or non-existent page.

Your job is to design a new template for this purpose, and then to select it in the drop-down menu above. Every time a site visitor tries to open a non-existent page, you can provide them with a message that something went wrong, and offer useful links to pages they might be interested in.

For example, this could be your 404 template:

{{ include file="_tpl/_html-head.tpl" }} <body>  <div id="top">       <div id="top-meta">           <div class="date">{{$smarty.now|camp_date_format:"%M %e, %Y"}}       </div> {{ include file="_tpl/top-search-box.tpl" }} </div>  <!-- /#top-meta -->       <div id="header">           <div class="logo">               <a href="http://{{ $gimme->publication->site }}" title="{{ $gimme->publication->name }}"><img src="http://{{ $gimme->publication->site }}/templates/_img/logo.png" alt=""></a>         </div><!-- /.logo -->     </div><!-- /#header --> </div><!-- /#top --> <div> {{ if ! $gimme->url->is_valid }}           <h1>Sorry, the requested page was not found.</h1> {{ /if }} </div> <div id="footer">       <ul id="category-nav"> {{ list_sections }}       <li class="cat-item"><a href="{{ uri options="section" }}" title="View all posts filed under {{ $gimme->section->name }}">{{ $gimme->section->name }}</a></li> {{ /list_sections }}         </ul>         <ul id="page-nav"> {{ set_issue number="1" }} {{ set_section number="5" }} {{ list_articles }}            <li class="page_item"><a href="{{ uri options="article" }}" title="{{ $gimme->article->name }}">{{ $gimme->article->name }}</a></li> {{ /list_articles }} {{ unset_section }}             <li style="border: medium none;" class="page_item"><a href="{{ uri options="template set_thejournal/archive.tpl" }}" title="Archives">Archives</a></li> {{ set_default_issue }}         </ul>     </div> </body> </html> 

A quicker solution may be to redirect all invalid URL requests back to your home page, but visitors deserve more precise information about what's going on, as well as a choice about what they want to do next.