Skip to content

Instantly share code, notes, and snippets.

@leomp12
Last active October 13, 2021 21:10
Show Gist options
  • Save leomp12/a8ab3dd9c72aec7696e1775e349a8a70 to your computer and use it in GitHub Desktop.
Save leomp12/a8ab3dd9c72aec7696e1775e349a8a70 to your computer and use it in GitHub Desktop.

Revisions

  1. leomp12 renamed this gist Oct 13, 2021. 1 changed file with 0 additions and 0 deletions.
  2. leomp12 renamed this gist Oct 13, 2021. 1 changed file with 0 additions and 0 deletions.
  3. leomp12 renamed this gist Oct 13, 2021. 1 changed file with 0 additions and 0 deletions.
  4. leomp12 revised this gist Oct 13, 2021. 1 changed file with 32 additions and 0 deletions.
    32 changes: 32 additions & 0 deletions new-folder-collection.json
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,32 @@
    {
    "collections": [
    {
    "name": "blog2",
    "label": "blog2",
    "folder": "content/blog2",
    "create": true,
    "fields": [
    {
    "label": "Title",
    "name": "title",
    "widget": "string"
    },
    {
    "label": "Publish Date",
    "name": "date",
    "widget": "datetime"
    },
    {
    "label": "Featured Image",
    "name": "thumbnail",
    "widget": "image"
    },
    {
    "label": "Body",
    "name": "body",
    "widget": "markdown"
    }
    ]
    }
    ]
    }
  5. leomp12 revised this gist Jan 21, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -4,7 +4,7 @@ Para manter as opções padrão do CMS e adicionar os novos campos,
    a maneira mais simples é editar o arquivo `template/public/admin/config.json`
    já criado por padrão em deploys a partir do [Storefront Starter](https://github.com/ecomplus/storefront-starter).

    Neste exemplo a configuração será acessada em `/admin/#/collections/settings/entries/theme`,
    Neste exemplo (`config.json` em anexo neste Gist) a configuração será acessada em `/admin/#/collections/settings/entries/theme`,
    para múltiplas páginas dentro da coleção _Configurações_ basta adicionar mais de um objeto no array _files_.

    Também é possível criar uma coleção nova em vez de usar a _Configurações_, neste caso utilize outro `name` e
  6. leomp12 created this gist Jan 21, 2021.
    34 changes: 34 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,34 @@
    # [Storefront](https://developers.e-com.plus/storefront/) - Adicionando uma página de configuração ao CMS

    Para manter as opções padrão do CMS e adicionar os novos campos,
    a maneira mais simples é editar o arquivo `template/public/admin/config.json`
    já criado por padrão em deploys a partir do [Storefront Starter](https://github.com/ecomplus/storefront-starter).

    Neste exemplo a configuração será acessada em `/admin/#/collections/settings/entries/theme`,
    para múltiplas páginas dentro da coleção _Configurações_ basta adicionar mais de um objeto no array _files_.

    Também é possível criar uma coleção nova em vez de usar a _Configurações_, neste caso utilize outro `name` e
    mais algumas propriedades:

    ```js
    {
    // ...
    name: 'theming',
    label: 'Tema',
    description: 'Configurações específicas do tema',
    delete: false,
    editor: {
    preview: false
    },
    files: [
    // ...
    ]
    }
    ```

    ### Links úteis

    - [Mais exemplos de `fields`](https://github.com/ecomplus/storefront/tree/master/%40ecomplus/storefront-template/template/js/netlify-cms/base-config/collections/settings)
    nas coleções padrão do Storefront;
    - [Referência do Netlify CMS](https://www.netlifycms.org/docs/collection-types/);

    27 changes: 27 additions & 0 deletions config.json
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,27 @@
    {
    "collections": [
    {
    "name": "settings",
    "files": [
    {
    "name": "theme",
    "label": "Configurações do tema",
    "file": "content/theme.json",
    "fields": [
    {
    "label": "Cor da tarja",
    "name": "stripe_color",
    "widget": "color"
    },
    {
    "label": "Texto do banner",
    "name": "banner_text",
    "widget": "string",
    "hint": "Texto exibido em cima do banner principal"
    }
    ]
    }
    ]
    }
    ]
    }