Overview
The template's data structures are shaped by options, which serve the following roles:
- Defining the structure of options, such as name, title, type, default value, etc.
- Allowing EarlyBird users to customize options when creating a landing page.
Example:
[
{
name: 'header',
title: 'Header',
fields: [
{
name: 'brand_name',
title: 'Brand name',
type: 'text',
default: 'EarlyBird',
ai: true
}
]
}
]
[
{
name: 'header',
title: 'Header',
fields: [
{
name: 'brand_name',
title: 'Brand name',
type: 'text',
default: 'EarlyBird',
ai: true
}
]
}
]
Option Group
Option Group organizes options within the same section, such as Header, Hero, FAQ, etc., making it convenient for EarlyBird users to manage them in one place.
To easily navigate to the corresponding preview area when editing an option, remember to use the Option Group's name as the section's id
.
[
{
name: 'header',
title: 'Header',
fields: []
}
]
[
{
name: 'header',
title: 'Header',
fields: []
}
]
<div id="header">
</div>
<div id="header">
</div>
name
- Type:
string
Each option must have a distinct name
that is unique within its level.
[
{
name: 'opt',
title: 'Header',
fields: [
{
name: 'title',
title: 'Logo',
},
{
name: 'title', // Error: name is same as Logo's name
title: 'Button'
}
]
},
{
name: 'opt', // Error: name is same as Header's name
title: 'Hero',
fields: []
}
]
[
{
name: 'opt',
title: 'Header',
fields: [
{
name: 'title',
title: 'Logo',
},
{
name: 'title', // Error: name is same as Logo's name
title: 'Button'
}
]
},
{
name: 'opt', // Error: name is same as Header's name
title: 'Hero',
fields: []
}
]
title
- Type:
string
The title of the option in EarlyBird serves two important purposes. Firstly, it helps users understand its purpose. Secondly, when generating copy with ChatGPT, the title also acts as the prompt content. Therefore, it is crucial for the title to accurately express its function.
title: 'Name'
title: 'Brand name'
title: 'Text'
title: 'Headline'
title: 'Name'
title: 'Brand name'
title: 'Text'
title: 'Headline'
type
- Type:
string
The type
determines how EarlyBird users set this option, it can be an input, select, image uploader, etc.
default
- Type:
any
The default value of the option is used to pre-fill the template when rendering.
ai
- Type:
boolean
Whether to use ChatGPT to assist EarlyBird users in generating copy, default is false
.
primary
- Type:
boolean
Used in the list sub-options, default is false
.
fields
Sub-options.
- Type:
Option[]