Querying Single Link Fields

Hi! New to Dato, used to Sanity.io. Iā€™m trying to link from a Block to a Modal via a Single Link Field but cannot find an example on how to query for this on the frontend.

Schema:

My query is currently like this and does work for the card content:

{
  cards {
     ...cardFieldsHiddenForBrevity
  }
}

I am unsure of what I need to use to get the name field inside of the JumpLink Link Field, something like:

_jumpLinkField {
  name
}

Is what feels like Iā€™d need but the exact syntax is not something I am able to find in the documentation. Any pointers would be much appreciated!

Hello @nnye and welcome to the community!

It looks like you are trying to query a block directly, this canā€™t be done, since blocks are always living inside ā€œModular contentā€ fields of a record, so they canā€™t be queried directly, only through the records that they are children of.

You can see on what ā€œModular contentā€ field this block is being used right here:

In your case, it seems like it lives in the ā€œSlicesā€ field, inside a ā€œHomeā€ model.
To query it you could run a query as following:

query MyQuery {
  home {
    slices {
      ... on LinedlistRecord {
        id
        heading
        jumplink {
          name
          position
          icon {
            url
          }
        }
        items {
          heading
          paragraph
        }
        button {
          label
          url
        }
      }
    }
  }
}