Go to page content

resource_id

Handle different content representations of a page.

Redirects to different representations of a page, depending on the requested content type. The redirect is done using a “303 See Other” status. When the requested page does not exist then a “404 Not Found” is returned.

When no content types are requested then “text/html” is selected.

This resource is also used for a page’s short url representation.

Example dispatch rule (from mod_base):

{id, ["id", id], resource_id, []}

This resource does not have any dispatch options.

This resource handles the following query argument:

ArgumentDescriptionExample
idId of the requested page./id/1234

The list of provided content types is collected with a foldr notification of  'content_types_dispatch'. Modules should add their provided content types in front of the accumulator. The added entries are tuples: {MimeType, DispatchRuleName}.

Example of adding a content type handler adding a text/plain handler for the dispatch rule rsc_text:

content_types_provided(content_types_dispatch, Acc, Context) ->
    [{"text/plain", rsc_text} | Acc].

This page is part of the Zotonic documentation, which is licensed under the Apache License 2.0.