Skip to content

nodeQuery and menuLinkContentQuery by url_alias #1

@johnmartin

Description

@johnmartin

I'm currently working on a headless Drupal site that is using the GraphQL module to provide data to a React frontend. However I'm beginning to get a little stuck.

Basically I've managed to run a query that get's the main menu items:

fragment menuFields on EntityMenuLinkContent {
  uuid
  title
  parent
  link {
    uri
  }
}

{
  main_menu: menuLinkContentQuery(menuName: "main") {
    ...menuFields
  }
}

Which is great for bootstrapping the menu on every page... BUT because within my Drupal instance I have URL aliases attached to nodes I'd really like to be able to return an alias if it's attached to EntityMenuLinkContent AND I'd really like to be able to run a nodeQuery(urlAlias: '/example-route')?

Any help pointing me in the right direction would be greatly appreciated as I'm a little stuck

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions