{:* Neutral TS - License in the terms described in the LICENSE file. *:}

{:*
    Index
    -----

    Entry point or router of the templates, any content is decided here by the "route"
    variable that we have previously defined in our APP, e.g.:

        schema["data"]["route"] = "home"

    This is just one of many strategies we can follow.

    You may wish to consult the following documentation:

    {:include; … :}   https://docs.rs/neutralts/latest/neutralts/doc/index.html#include--
    {:data; … :}      https://docs.rs/neutralts/latest/neutralts/doc/index.html#data--
    {:locale; … :}    https://docs.rs/neutralts/latest/neutralts/doc/index.html#locale--
    {:eval; … :}      https://docs.rs/neutralts/latest/neutralts/doc/index.html#eval--
    {:snippet; … :}   https://docs.rs/neutralts/latest/neutralts/doc/index.html#snippet--
*:}

{:*
    First we load the app snippets, there are things like checking
    the 404 error that depend on it.
*:}
{:^include; {:flg; require :} >> #/app-snippets.ntpl :}

{:*
    The route snippet checks with allow if the route is valid, if not
    it gives an empty string and in that case error 404.
*:}
{:^!eval; {:snippet; route :} >>
    {:exit; 404 :}
:}

{:*
    Generic locale if it exists
*:}
{:^locale; #/../data/locale-{:snippet; lang :}.json :}

{:*
    Locale for current route and lang if it exists
*:}
{:^locale; #/../data/route-{:snippet; route :}-locale-{:snippet; lang :}.json :}

{:*
    Data for current theme if it exists
*:}
{:^data; #/../data/theme-data.json :}

{:*
    Data for current site if it exists
*:}
{:^data; #/../data/site-data.json :}

{:*
    Data for current route if it exists
*:}
{:^data; #/../data/route-{:snippet; route :}-data.json :}

{:*
    Snippets of this theme, the order is important, as these
    snippets can be overwritten by our configuration.
*:}
{:^include; {:flg; require :} >> #/theme-snippets.ntpl :}

{:*
    Custom theme configuration snippets, overwrite the snippets needed theme-snippets
*:}
{:^include; {:flg; require :} >> #/theme-setting-snippets.ntpl :}

{:*
    Content of the route
    e.g.: contents-home-snippets.ntpl
*:}
{:^include; #/contents-{:snippet; route :}-snippets.ntpl :}

{:*
    Render theme
*:}
{:^include; {:flg; require :} >> #/theme.ntpl :}
