Sha256: 79e22dea9327d87ac834622aba304d8b0a1abbfe99c1b676744dcfffe00ef3c9

Contents?: true

Size: 1.07 KB

Versions: 8

Compression:

Stored size: 1.07 KB

Contents

import Migration from 'contentful-migration-cli'

export = function (migration: Migration) {
  const page = migration.createContentType('page')
    .name('Page')
    .description('A page describes a collection of sections that correspond' +
     'to a URL slug')
    .displayField('title')

  page.createField('title')
    .name('Title')
    .type('Symbol')
    .required(true)

  page.createField('slug')
    .name('Slug')
    .type('Symbol')
    .required(true)
    .validations([
      {
        unique: true
      },
      {
        regexp: { pattern: "(\\/|\\/([\w#!:.?+=&%@!\\-\\/]))?$" },
        message: "The slug must look like the path part of a URL and begin with a forward slash, example: '/my-page-slug'"
      }
    ])

  page.createField('sections')
    .name('Sections')
    .type('Array')
    .items({
      type: 'Link',
      linkType: 'Entry'
    })

  page.createField('subpages')
    .name('Subpages')
    .type('Array')
    .items({
      type: 'Link',
      linkType: 'Entry',
      validations: [
        {
          linkContentType: [ 'page' ]
        }
      ]
    })

}

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
wcc-contentful-app-0.4.0.pre.rc lib/generators/wcc/templates/page/generated_add_pages.ts
wcc-contentful-app-0.4.0.pre.alpha lib/generators/wcc/templates/page/generated_add_pages.ts
wcc-contentful-0.3.0 lib/generators/wcc/templates/page/generated_add_pages.ts
wcc-contentful-app-0.3.0.pre.rc3 lib/generators/wcc/templates/page/generated_add_pages.ts
wcc-contentful-app-0.3.0.pre.rc2 lib/generators/wcc/templates/page/generated_add_pages.ts
wcc-contentful-app-0.3.0.pre.rc lib/generators/wcc/templates/page/generated_add_pages.ts
wcc-contentful-app-0.2.2 lib/generators/wcc/templates/page/generated_add_pages.ts
wcc-contentful-0.2.2 lib/generators/wcc/templates/page/generated_add_pages.ts