resource_static_pages
Serve a static page or pages.
With this Webmachine resource it is possible to add a static sub site to your Zotonic site. Add the site and all files to a directory in your template directory or your site’s directory and define the directory in a dispatch rule.
Example dispatch rule:
{oldsite, ["old", '*'], resource_static_pages, [{root, "old_site"}]}When a file "a.txt" is requested this resource will check for "a.txt" and "a.txt.tpl". When it finds a ".tpl" file then that file be handled as a template. All dispatch configuration variables are available in the template.
Directories will be redirected to the directory name with a "/" appended. The resource serves the file "index.html" or "index.html.tpl" for the directory contents.
It has the following dispatch options:
| Option | Description | Example |
| root | Name of the directory in the templates (or site) directory containing the static files. | {root, "mydir"} |
| use_cache | Whether or not served files are cached in memory for an hour. Defaults to false. Use this for high-volume traffic when the files themselves do not change often. | {use_cache, true} |
| allow_directory_index | Whether or not to serve a directory listing when no index file is found. Defaults to false. The directory index is rendered using directory_index.tpl in mod_base. (zotonic >= 0.9) | {allow_directory_index, true} |
This resource does not handle any request arguments.
This page is part of the Zotonic documentation, which is licensed under the Apache License 2.0.