Path

    A path field is used to generate a slug based on another field - by default, the title field.

    import {Field} from 'alinea'
    
    Field.text('Title', {required: true, width: 0.5}),
    Field.path('Path', {required: true, width: 0.5})

    Configuration

    from

    Automatically generate (slugify) the path from another field.

    import {Config, Field} from 'alinea'
    
    export default Config.type('Path field (from)', {
      fields: {
        anchorId: Field.text('anchorId', {
          initialValue: 'Anchord ID',
          required: true, width: 0.5
        }),
        pathFrom: Field.path('Path from anchorId)', {
          from: 'anchorId',
          required: true, width: 0.5
        })
      }
    })

    initialValue

    Prefills the path value. This is useful for cases like setting the homepage path.

    import {Config, Field} from 'alinea'
    
    export default Config.type('Path field (homepage)', {
      fields: {
        title: Field.text('Title', {
          initialValue: 'Homepage',
          required: true, width: 0.5
        }),
        path: Field.path('Path', {
          initialValue: 'index',
          hidden: false,
          readOnly: true,
          required: true, width: 0.5
        })
      }
    })