Advanced blue print for multi level front matter

I am trying to create a blueprint for the front matter data below, can someone suggest to me how I can set my data out in this structure

I have previously created fields with list but this data structure is a whole load more complex so any suggestions would be greatly appreciated

type: "FeatureCollection"
features:

  - geometry:
      type: "Point"
      coordinates:
        - 104.67
        - -26.62
    type: "Feature"
    properties:
      category: "category"
      hours: "9am - 5pm"
      description: "<p>Description</p>"
      company: "Company Name"
      name: "Contact Name"
      address: "Address"
      phone: "phone1"
      phone2: "phone2"
      email: "email1"
      email2: "email2"
      website: "website1"
      facebook: "website2"

  - geometry:
      type: "Point"
      coordinates:
        - 104.67
        - -26.62
    type: "Feature"
    properties:
      category: "category"
      hours: "9am - 5pm"
      description: "<p>Description</p>"
      company: "Company Name"
      name: "Contact Name"
      address: "Address"
      phone: "phone1"
      phone2: "phone2"
      email: "email1"
      email2: "email2"
      website: "website1"
      facebook: "website2"

Hello dean_007.

GRAV Frontmatter is agnostic as long as the yaml syntax is correct. This means you can use the Frontmatter to store data structures “unknown” to GRAV. The GEO data structure you expose here cannot be handled by GRAV out of the box and I don’t know if there’s a plugin that allows you to handle this. What’s probably needed is a dedicated plugin and / or field type for this data or you have to rewrite the data structure to adapt to what’s available out of the box in GRAV. GRAV offers exhaustive information on fields, types, collections and their usage in pages: Learn GRAV: Forms

the way I have approached this is to use a list at the features level

header.features:
      name: Features
      type: list
      style: vertical
      label: Features

then create a custom heading underneath

.geometry.type:
   type: select
   label: Select one of the following geometry types
   default: Point
.type:
     type: hidden
     default: "Feature"
.properties.hours:
      type: text
      label: Enter Opening Hours

I’m still to work out how to create the coords yet, but with a little persistence I’m sure ill get there

coordinates:
        - 55.588
        - -32.627

For the coordinates you could use the Array Field with ‘value_only: true’

1 Like

I did try the Array field originally but overlooked the value only, it works but I need the value to be saved as a number and not a string i.e. 174.7676 instead of ‘174.7676’

to resolve the other issues is used this to save my data I used a field sets for geometry and properties worked like a charm using lists just didn’t work with other sublevel items

There is also the multilevel field, which is still a WIP and not documented yet, but could fit your needs.