The next stage of building our Release Notes section is to create our custom fields.
What are custom fields?
By default, a database in Pages has some generic fields set up for you - things like the record title and record content. In most cases though, you'll need other types of information for each record too, and that's where custom fields come in. They allow you to define other pieces of information about records, which is displayed as part of the record. Pages supports a wide range of field types, from dates to upload fields to YouTube embeds.
Fields we need to create
If we refer back to the screenshot of our final product, we can identify a few different custom fields we're going to need to create:
Template Key: long-id
Show in listing/display template: No
Each version of the IPS Community Suite has a public version (e.g. 4.1) and an internal 'long ID' that identifies it more technically. We need to create a Long ID field in our database because this is how we will order the releases. We won't however be displaying this on the page - it's only used behind the scenes.
Template Key: release-date
The date we'll show for the release. If the person adding a new release leaves this blank, we'll treat it as a future release.
Template Key: security-release
We highlight security releases in the listing with a triangle icon. By setting a yes/no flag on a field, we can check that value later in the templates to decide whether to show the icon.
Template Key: current-release
We also highlight the most current release in the listing. Note: it isn't currently possible to have a field that is only 'yes' for one record automatically, so right now we need to unset this on one record before setting it on another. For our usage, that isn't a problem.
Template Key: beta-release
Finally we indicate which releases are currently in beta with a badge, so we need a flag to store that.
Template Key: additional-information
Show in listing template: No
For our use, we put important information in the main content of the record, but have this field for any additional but less-important information we want to include.
We won't walk through creating every field here since it's largely the same for each, but we'll create one shortly.
You'll notice above I mention the template key, which is set on the Display tab when creating a field. This is a key we will use to refer to each field when we write our templates later. If we don't set this, Pages will set one for us anyway, but it's generally easier to follow if you enter one yourself.
You'll also see on the Display tab some settings for formatting the fields. Leave these at their default state for now; we will cover field formatters in depth later.
Creating a field
Let's go ahead and create the Long ID field. Assuming you are still on the database listing page, click the dropdown arrow next to our Release Notes database, and choose Manage Fields. On that screen you will see the default fields that Pages gives you:
Click the Create New button, and you'll see the field form. Following the information we covered above, set the field options:
When you submit the form, you'll see the permission matrix for this field, allowing us to define who can do what with it. If you recall, we only allow staff to add/edit records in this database anyway, so we will mirror those permissions here too.
Finally, save the form to add the field. You can repeat these steps for the remaining fields.