Hi Scott,

Scott Taylor schrieb:
> In my sling repository I've defined a /apps/foo/bar/html.esp which
> decorates all my web pages with the standard layout used through out the
> site.
> 
> Eg.
> 
> <html>
>  <head>
>    <title><%= currentNode.title %></title>
>    <!-- css imports, favicon etc. -->
>  </head>
>  <body>
>    <h1><%= currentNode.title %></h1>
>    <%=currentNode.text %>
>     <!-- html code for footer with copyright notice, etc -->
>  </body>
> </html>
> 
> Now when any node with sling:resourceType=/foo/bar is accessed it is
> automatically decorated with the website's standard layout. This is
> awesome and I would like to be able to use the above html.esp to
> decorate even error pages like 404. For example, I would like to be able
> to create a node with a title property of "Page Not Found" and a text
> property like "<p>Sorry the page you were looking for was not
> found</p>", and have Sling render 404 error pages using that node and
> the /apps/foo/bar/html.esp script. Is this possible with Sling?
> 
> I'm aware that I can create a /apps/sling/servlet/errorhandler/404.esp
> file but that doesn't allow me to use the /apps/foo/bar/html.esp decorator.

You might want to create a /apps/sling/content/error404 node, set the
sling:resourceType, title, and text properties and in your error handler
you do:

<%
    sling.include("/apps/sling/content/error404.html");
%>

This will return a page with your decorator etc.

Regards
Felix

Reply via email to