{"result":{"depiction_url":null,"edges":{"in_module":{"objects":[{"created":"2020-05-30T05:48:02Z","object_id":{"id":1296,"is_a":["text","documentation","reference","module"],"name":"doc_module_mod_base","title":"mod_base","uri":"https:\/\/zotonic.com\/id\/1296"},"seq":1000000}],"predicate":{"id":333,"is_a":["meta","predicate"],"name":"in_module","title":{"_type":"trans","tr":{"en":"In module"}},"uri":"https:\/\/zotonic.com\/id\/in_module"}},"subject":{"objects":[{"created":"2026-09-09T13:47:52Z","object_id":{"id":2555,"is_a":["categorization","keyword","keyword_information_type"],"name":"zotonic_topic_reference","title":"Reference","uri":"https:\/\/zotonic.com\/id\/2555"},"seq":1},{"created":"2026-09-09T13:47:52Z","object_id":{"id":2564,"is_a":["categorization","keyword","keyword_audience"],"name":"zotonic_topic_backend_developer","title":"Backend developer","uri":"https:\/\/zotonic.com\/id\/2564"},"seq":2},{"created":"2026-09-09T13:47:52Z","object_id":{"id":2608,"is_a":["categorization","keyword","keyword_domain"],"name":"zotonic_topic_routing_and_redirects","title":"Routing and redirects","uri":"https:\/\/zotonic.com\/id\/2608"},"seq":3},{"created":"2026-09-09T13:47:52Z","object_id":{"id":2620,"is_a":["categorization","keyword","keyword_architecture"],"name":"zotonic_topic_template","title":"Template","uri":"https:\/\/zotonic.com\/id\/2620"},"seq":4},{"created":"2026-09-09T13:47:52Z","object_id":{"id":2626,"is_a":["categorization","keyword","keyword_architecture"],"name":"zotonic_topic_controller","title":"Controller","uri":"https:\/\/zotonic.com\/id\/2626"},"seq":5},{"created":"2026-09-09T13:47:52Z","object_id":{"id":2641,"is_a":["categorization","keyword","keyword_task"],"name":"zotonic_topic_render","title":"Render","uri":"https:\/\/zotonic.com\/id\/2641"},"seq":6},{"created":"2026-09-09T13:47:52Z","object_id":{"id":2672,"is_a":["categorization","keyword","keyword_technology"],"name":"zotonic_topic_html","title":"HTML","uri":"https:\/\/zotonic.com\/id\/2672"},"seq":7}],"predicate":{"id":308,"is_a":["meta","predicate"],"name":"subject","title":{"_type":"trans","tr":{"en":"Keyword"}},"uri":"http:\/\/purl.org\/dc\/elements\/1.1\/subject"}}},"id":1897,"is_a":["text","documentation","reference","controller"],"links":[{"rel":"self","target":"https:\/\/zotonic.com\/.zotonic\/websub\/topic\/1897"},{"rel":"hub","target":"https:\/\/zotonic.com\/.zotonic\/websub"}],"medium":null,"medium_url":null,"name":"doc_controller_controller_static_pages","page_url":{"en":"https:\/\/zotonic.com\/docs\/1897\/controller_static_pages","x-default":"https:\/\/zotonic.com\/docs\/1897\/controller_static_pages"},"preview_url":null,"resource":{"version":3323,"pivot_location_lat":null,"title":"controller_static_pages","is_authoritative":true,"body":"<p>Serve a static page or pages.<\/p>\n<p>With this controller it is possible to add a folder with static files as a sub-site to your Zotonic site. Add the folder\nand all files to a directory in your template directory or your site’s directory and define the directory in a\ndispatch rule.<\/p>\n<p>Example dispatch rule:<\/p>\n<pre class=\"notranslate\"><code class=\"notranslate language-erlang\">{oldsite, [&quot;old&quot;, &#39;*&#39;], controller_static_pages, [{root, &quot;priv\/old_site&quot;}]}\n<\/code><\/pre>\n<p>When a file <code>a.txt<\/code> is requested this resource will check for <code>a.txt<\/code> and <code>a.txt.tpl<\/code>. When it finds a <code>.tpl<\/code> file then\nthat file be handled as a template. All dispatch configuration variables are available in the template.<\/p>\n<p>Directories will be redirected to the directory name with a <code>\/<\/code> appended. The resource serves the file <code>index.html<\/code> or\n<code>index.html.tpl<\/code> for the directory contents. If these are not found, it will give a 404 page, unless the\n<code>allow_directory_index<\/code> option is set; in which case a directory listing is displayed.<\/p>\n<p>It has the following dispatch options:<\/p>\n<table class=\"table\"><thead><tr><th>Option<\/th><th>Description<\/th><th>Example<\/th><\/tr><\/thead><tbody><tr><td><code>root<\/code><\/td><td>Name of the directory in the site directory containing the static files. The root is a path name relative to the current site’s base directory or <code>{files, &quot;some\/path&quot;}<\/code> for a path relative to a site‘s files directory.<\/td><td><code>{root, “priv\/oldsite”}<\/code><\/td><\/tr><tr><td><code>use_cache<\/code><\/td><td>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.<\/td><td><code>{use_cache, true}<\/code><\/td><\/tr><tr><td><code>allow_directory_index<\/code><\/td><td>Whether or not to serve a directory listing when no index file is found. Defaults to false. The directory index is rendered using <a href=\"..\/templates\/template_directory_index.html#template-directory-index\"><code>directory_index.tpl<\/code><\/a>. New in version 0.9.<\/td><td><code>{allow_directory_index, true}<\/code><\/td><\/tr><\/tbody><\/table>\n<p>This resource does not handle any request arguments.<\/p>","slug":"controller_static_pages","is_protected":false,"visible_for":0,"tz":"UTC","language":["en"],"doc_source_hash":"69cfaa830f51176b0573b022d3dea5fa71df754392eb2c5d878b8da50ad27e93","is_featured":false,"content_group_id":{"id":2551,"is_a":["meta","content_group"],"name":"content_group_imported_docs","title":"Imported documentation","uri":"https:\/\/zotonic.com\/id\/content_group_imported_docs"},"category_id":{"id":321,"is_a":["meta","category"],"name":"controller","title":"Controllers","uri":"https:\/\/test.zotonic.com\/id\/321"},"doc_source_path":"apps\/zotonic_mod_base\/src\/controllers\/controller_static_pages.erl","publication_start":"2023-01-30T19:24:03Z","github_url":"https:\/\/github.com\/zotonic\/zotonic\/blob\/master\/apps\/zotonic_mod_base\/src\/controllers\/controller_static_pages.erl","pivot_location_lng":null,"doc_source_kind":"controller","name":"doc_controller_controller_static_pages","is_unfindable":false,"is_published":true,"pivot_geocode":null,"created":"2020-05-30T05:47:42Z","uri":null,"doc_status":"current","is_dependent":false,"erlang_app":"zotonic_mod_base","publication_end":"9999-06-01T00:00:00Z","modifier_id":{"id":1,"is_a":["person"],"name":"administrator","title":"Site Administrator","uri":"https:\/\/zotonic.com\/id\/1"},"privacy":0,"doc_source_commit":"b8c4b2ccdc223257f311968fbd17b2d66f0c4156\n","erlang_module":"controller_static_pages","creator_id":{"id":336,"is_a":["person","robot"],"name":"gitbot","title":"Git","uri":"https:\/\/zotonic.com\/id\/336"},"modified":"2026-09-30T09:39:41Z","title_slug":"controller_static_pages"},"uri":"https:\/\/zotonic.com\/id\/1897","uri_template":"https:\/\/zotonic.com\/id\/:id","websub":{"hub":"https:\/\/zotonic.com\/.zotonic\/websub","topic":"https:\/\/zotonic.com\/.zotonic\/websub\/topic\/1897"}},"status":"ok"}