Skip to content

Sections

spAnser edited this page Nov 2, 2016 · 15 revisions

Locale support only in versions higher than v1.0.2 . Locale support was changed/fixed in v1.5.3.1 . In v1.5.5 the no urls example below is available to use fixing section import when hasUrls is set to false.

{
    "sections": [{
        "name": "Home Page",
        "handle": "homePage",
        "type": "single",
        "enableVersioning": true,
        "typesettings": {
            "urlFormat": "__home__", // "__home__" string designates homepage
            "template": "home-page"
        }
    },
    {
        "name": "Single Page",
        "handle": "singlePage",
        "type": "single",
        "enableVersioning": true,
        "typesettings": {
            "urlFormat": "{slug}", // Set to primary locale id when not nested in locale id object
            "defaultLocaleStatus": false, // True if omitted. Do not use in single locale Environment
            "template": "single-page",
            "fr": {
                "defaultLocaleStatus": false, // True if omitted
                "urlFormat": "fr-structure-page\/{slug}"
            }
        }
    },
    {
        "name": "Channel Page",
        "handle": "channelPage",
        "type": "channel",
        "enableVersioning": true,
        "typesettings": {
            "hasUrls": true,
            "urlFormat": "channel-page/{slug}", // only needed if "hasUrls". Set to primary locale id when not nested in locale id object
            "template": "channel-page/_entry", // only needed if "hasUrls"
            "fr": {
                "urlFormat": "fr-channel-page/{slug}"
            }
        }
    },
    {
        "name": "Structure Page",
        "handle": "structurePage",
        "type": "structure",
        "enableVersioning": false,
        "typesettings": {
            "hasUrls": true,
            "urlFormat": "structure-page/{slug}", // only needed if "hasUrls". Set to primary locale id when not nested in locale id object
            "nestedUrlFormat": "{parent.uri}/{slug}", // only needed if "hasUrls". Set to primary locale id when not nested in locale id object
            "template": "structure-page/_entry", // only needed if "hasUrls"
            "maxLevels": 2,
            "fr": {
                "urlFormat": "fr-structure-page/{slug}",
                "nestedUrlFormat": "{parent.uri}/{slug}"
            }
        }
    },
    {
        "name": "No Urls",
            "handle": "noUrls",
            "type": "structure",
            "enableVersioning": 1,
            "typesettings": {
                "hasUrls": false,
                "template": "no-urls",
                "locales": {
                    "en_us": 1, // en_us is enabled by default
                    "fr": 0 // fr is disabled by default
                }
            }
    }]
}
Clone this wiki locally