Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Requirements for extending the Drupal json api for node pages with views to include breadcrumbs and weight.

Task: Add weight and breadcrumbs attributes to node pages.

Using the json api for "Jobs at the Library" Drupal node page as the example. For full:

Breadcrumb specs:

  • Start at the homepage.
  • Attach property of breadcrumbs with an array of objects as the value.
  • Each object in the array contains text and to. text is the page title. to is the alias to that page.

Weight specs:

  • The weight of the page corresponding to the order set by Drupal content administrators.
attributes: {
  breadcrumbs: [
    { text: 'Home', to: '/' },
    { text: 'About Us', to: '/about-us' },
    { text: 'Jobs at the Library', to: '/about-us/jobs-at-library' }
  weight: 3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.