Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Customisation of the 404 page
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  9 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Marek Setnicka  
View profile  
 More options Nov 6 2012, 4:05 am
From: Marek Setnicka <msetni...@gmail.com>
Date: Tue, 6 Nov 2012 01:05:03 -0800 (PST)
Local: Tues, Nov 6 2012 4:05 am
Subject: Customisation of the 404 page

Hi guys,

what is the best way to conditionally serve the 404 (or 410) page?
My scenario is simple: I'd like to be able to show a 404 (410) page with a
customised content (different from the standard 404 that Zotonic returns)
and based on a condition depending on data in the database.

I am not very experienced with Erlang or using Webmachine for that matter.
I have looked at all various options, from using resource_html to using
webmachine_resource and have been primarily looking for a Zotonic way. I
haven't found such a way.
The way I see doable is to use resource_html and in the html/1 function
retrieve the ReqData from z_context (get_reqdata/1), append a custom body
to it using webmachine_request:append_to_response_body/2 and then send
response back using webmachine_request:send_response/2.
Is there a better way to achieve what I need? Any hints will be much
appreciated.

Have a sunny day,
Marek


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Andreas Stenius  
View profile  
 More options Nov 6 2012, 4:13 am
From: Andreas Stenius <andreas.sten...@astekk.se>
Date: Tue, 6 Nov 2012 10:13:19 +0100
Local: Tues, Nov 6 2012 4:13 am
Subject: Re: [Zotonic-Usr] Customisation of the 404 page

Hi,

Take a look at error.tpl from mod_base (
https://github.com/zotonic/zotonic/blob/master/modules/mod_base/templ...
 ).

You can override that to customize the response for various error codes.

//Andreas

2012/11/6 Marek Setnicka <msetni...@gmail.com>


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Marek Setnicka  
View profile  
 More options Nov 6 2012, 11:31 am
From: Marek Setnicka <msetni...@gmail.com>
Date: Tue, 6 Nov 2012 08:31:57 -0800 (PST)
Local: Tues, Nov 6 2012 11:31 am
Subject: Re: [Zotonic-Usr] Customisation of the 404 page

Many thanks, Andreas.

Any idea how to generate a 410 (Gone) page instead of 404?

Marek


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Arjan Scherpenisse  
View profile  
 More options Nov 6 2012, 4:50 pm
From: Arjan Scherpenisse <ar...@scherpenisse.net>
Date: Tue, 06 Nov 2012 22:50:08 +0100
Local: Tues, Nov 6 2012 4:50 pm
Subject: Re: [Zotonic-Usr] Customisation of the 404 page

On 11/06/2012 05:31 PM, Marek Setnicka wrote:

> Many thanks, Andreas.

> Any idea how to generate a 410 (Gone) page instead of 404?

The templates only allow customization of the HTML content of the error
page, not of the error codes itself. Those codes are created by the
controller that is used to serve the URL that was requested.

When you're talking about 410 Gone I assume you want to have that
indication when you delete a page (rsc) from the database. The default
page controller (controller_page) does not yet have the functionality to
emit 410 error codes, as this would need an administration of pages
which once existed but are now gone ("tombstones").

Patches welcome, of course ;-)

For example, the controller_page could implement
webmachine's/previously_existed/2/ function, which might do a lookup in
a tombstone table, which would be filled when a rsc gets deleted.

Arjan


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Marc Worrell  
View profile  
 More options Nov 6 2012, 5:27 pm
From: Marc Worrell <mworr...@me.com>
Date: Tue, 06 Nov 2012 23:27:17 +0100
Local: Tues, Nov 6 2012 5:27 pm
Subject: Re: [Zotonic-Usr] Customisation of the 404 page

Such a "rsc_gone" table would be nice.
Especially when you can also give a new url and/or resource id.

- Marc

On 6 nov. 2012, at 22:50, Arjan Scherpenisse wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Andreas Stenius  
View profile  
 More options Nov 7 2012, 4:31 am
From: Andreas Stenius <andreas.sten...@astekk.se>
Date: Wed, 7 Nov 2012 10:31:40 +0100
Local: Wed, Nov 7 2012 4:31 am
Subject: Re: [Zotonic-Usr] Customisation of the 404 page

Not bad at all! :)

2012/11/6 Marc Worrell <mworr...@me.com>


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Marc Worrell  
View profile  
 More options Nov 7 2012, 2:37 pm
From: Marc Worrell <mworr...@me.com>
Date: Wed, 07 Nov 2012 20:37:20 +0100
Local: Wed, Nov 7 2012 2:37 pm
Subject: Re: [Zotonic-Usr] Customisation of the 404 page

Please check this issue and see if this would do the job:

https://github.com/zotonic/zotonic/issues/450

- Marc

On 7 nov. 2012, at 10:31, Andreas Stenius wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Marc Worrell  
View profile  
 More options Nov 8 2012, 8:02 am
From: Marc Worrell <mworr...@me.com>
Date: Thu, 08 Nov 2012 14:02:15 +0100
Local: Thurs, Nov 8 2012 8:02 am
Subject: Re: [Zotonic-Usr] Customisation of the 404 page

Support for '410 Gone' status tracking has been added.

For now the support is quite simple.
The data model supports a new id (replacing the deleted id) or a new uri.

This is for later functionality where we want to delete a resource, replacing its spot with another resource.

The controllers 'page' and 'id' are modified for support of 410 gone.

- Marc

On 7 nov. 2012, at 20:37, Marc Worrell wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Marek Setnicka  
View profile  
 More options Nov 8 2012, 2:41 pm
From: Marek Setnicka <msetni...@gmail.com>
Date: Thu, 8 Nov 2012 11:41:27 -0800 (PST)
Local: Thurs, Nov 8 2012 2:41 pm
Subject: Re: [Zotonic-Usr] Customisation of the 404 page

Hi Marc and others,

I'd like to say thank you for being so incredibly efficient and being able
to action this thing so fast. You're truly inspirational!

Best wishes,
Marek


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »