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
Many thanks, Andreas.
Any idea how to generate a 410 (Gone) page instead of 404?