Navigation root

Nick has a concept called navigation root which provides a way to root catalog queries, searches, breadcrumbs, and so on in a given section of the site. This feature is useful when working with subsites or multilingual sites, because it allows the site manager to restrict searches or navigation queries to a specific location in the site.

This navigation root information is different depending on the context of the request. For instance, in a default multilingual site when browsing the contents inside a language folder such as www.domain.com/en, the context is en and its navigation root will be /en/. In a non-multilingual site, the context is the root of the site such as www.domain.com and the navigation root will be /.

To get the information about the navigation root, the REST API has a @navroot contextual endpoint. For instance, send a GET request to the @navroot endpoint at the root of the site:

GET /news/@navroot HTTP/1.1
Accept: application/json
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJhZG1pbiIsImZ1bGxuYW1lIjoiQWRtaW4iLCJpYXQiOjE2NDkzMTI0NDl9.RS1Ny_r0v7vIylFfK6q0JVJrkiDuTOh9iG9IL8xbzAk

Or use the client directly:

import { Client } from '@plone/nick';

const cli = Client.initialize({ apiPath: 'http://localhost:8080' });
const login = await cli.login({
  data: { login: 'admin', password: 'admin' },
});

const { data } = await cli.getNavroot({
  token: login.data.token,
  path: '/news',
});

The response will contain the navigation root information for the site:

HTTP/1.1 200 OK
Content-Type: application/json

{
  "@id": "http://localhost:8080/news/@navroot",
  "navroot": {
    "title": "Welcome to Nick!",
    "blocks": {
      "79ba8858-1dd3-4719-b731-5951e32fbf79": {
        "@type": "title"
      },
      "0f06cd6f-5282-4966-9d4d-3abeba13953c": {
        "@type": "slate",
        "value": [
          {
            "type": "p",
            "children": [
              {
                "text": "This is the demo site of "
              },
              {
                "type": "link",
                "data": {
                  "url": "https://nick.docs.plone.org"
                },
                "children": [
                  {
                    "text": "Nick"
                  }
                ]
              },
              {
                "text": " and is build with the "
              },
              {
                "type": "link",
                "data": {
                  "url": "https://voltocms.com"
                },
                "children": [
                  {
                    "text": "Volto"
                  }
                ]
              },
              {
                "text": " frontend."
              }
            ]
          }
        ],
        "plaintext": "This is the demo site of Nick and is build with the Volto frontend."
      },
      "e47fdd86-5d1b-4e6c-86a4-f3edf9d74e31": {
        "@type": "slate",
        "value": [
          {
            "type": "h2",
            "children": [
              {
                "text": "Demo"
              }
            ]
          }
        ],
        "plaintext": "Demo"
      },
      "a6ba1f90-3bd0-4daa-869f-532c38d4c522": {
        "@type": "slate",
        "value": [
          {
            "type": "p",
            "children": [
              {
                "text": "You can use this site to test the latest version of Nick. You can login with "
              },
              {
                "type": "em",
                "children": [
                  {
                    "text": "username"
                  }
                ]
              },
              {
                "text": " "
              },
              {
                "type": "strong",
                "children": [
                  {
                    "text": "admin"
                  }
                ]
              },
              {
                "text": " and "
              },
              {
                "type": "em",
                "children": [
                  {
                    "text": "password"
                  }
                ]
              },
              {
                "text": " "
              },
              {
                "type": "strong",
                "children": [
                  {
                    "text": "admin"
                  }
                ]
              },
              {
                "text": "."
              }
            ]
          }
        ],
        "plaintext": "You can use this site to test the latest version of Nick. You can login with username  admin and password  admin ."
      },
      "59ddb72e-2691-4571-b07c-eedbd843b613": {
        "@type": "slate",
        "value": [
          {
            "type": "p",
            "children": [
              {
                "text": "This instance is reset every night so feel free to make any changes!"
              }
            ]
          }
        ],
        "plaintext": "This instance is reset every night so feel free to make any changes!"
      }
    },
    "blocks_layout": {
      "items": [
        "79ba8858-1dd3-4719-b731-5951e32fbf79",
        "0f06cd6f-5282-4966-9d4d-3abeba13953c",
        "e47fdd86-5d1b-4e6c-86a4-f3edf9d74e31",
        "a6ba1f90-3bd0-4daa-869f-532c38d4c522",
        "59ddb72e-2691-4571-b07c-eedbd843b613"
      ]
    },
    "effective": "2022-04-02T20:00:00.000Z",
    "description": "Congratulations! You have successfully installed Nick.",
    "items": [
      {
        "title": "Events",
        "blocks": { "79ba8858-1dd3-4719-b731-5951e32fbf79": { "@type": "title" } },
        "effective": "2022-04-02T20:30:00.000Z",
        "blocks_layout": { "items": ["79ba8858-1dd3-4719-b731-5951e32fbf79"] },
        "@id": "http://localhost:8080/events",
        "@type": "Folder",
        "id": "events",
        "created": "2022-04-02T20:30:00.000Z",
        "modified": "2022-04-02T20:30:00.000Z",
        "UID": "1a2123ba-14e8-4910-8e6b-c04a40d72a41",
        "owner": "admin",
        "relatedItems": [
          "32215c67-86de-462a-8cc0-eabcd2b39c26"
        ],
        "layout": "view",
        "is_folderish": true,
        "language": { "token": "en", "title": "English" },
        "review_state": "published",
        "lock": { "locked": false, "stealable": true }
      },
      {
        "title": "News",
        "blocks": { "79ba8858-1dd3-4719-b731-5951e32fbf79": { "@type": "title" } },
        "effective": "2022-04-02T20:22:00.000Z",
        "description": "News Items",
        "blocks_layout": { "items": ["79ba8858-1dd3-4719-b731-5951e32fbf79"] },
        "@id": "http://localhost:8080/news",
        "@type": "Folder",
        "id": "news",
        "created": "2022-04-02T20:22:00.000Z",
        "modified": "2022-04-02T20:22:00.000Z",
        "UID": "32215c67-86de-462a-8cc0-eabcd2b39c26",
        "owner": "admin",
        "layout": "view",
        "is_folderish": true,
        "language": { "token": "en", "title": "English" },
        "review_state": "published",
        "lock": { "locked": false, "stealable": true }
      },
      {
        "title": "Users",
        "blocks": { "79ba8858-1dd3-4719-b731-5951e32fbf79": { "@type": "title" } },
        "effective": "2022-04-02T20:24:00.000Z",
        "blocks_layout": { "items": ["79ba8858-1dd3-4719-b731-5951e32fbf79"] },
        "@id": "http://localhost:8080/users",
        "@type": "Folder",
        "id": "users",
        "created": "2022-04-02T20:24:00.000Z",
        "modified": "2022-04-02T20:24:00.000Z",
        "UID": "80994493-74ca-4b94-9a7c-145a33a6dd80",
        "owner": "admin",
        "layout": "view",
        "is_folderish": true,
        "language": { "token": "en", "title": "English" },
        "review_state": "published",
        "lock": { "locked": false, "stealable": true }
      }
    ],
    "@id": "http://localhost:8080",
    "@type": "Site",
    "id": "root",
    "created": "2022-04-02T20:00:00.000Z",
    "modified": "2022-04-02T20:00:00.000Z",
    "UID": "92a80817-f5b7-400d-8f58-b08126f0f09b",
    "owner": "admin",
    "layout": "view",
    "is_folderish": true,
    "language": { "token": "en", "title": "English" },
    "review_state": "published",
    "lock": { "locked": false, "stealable": true }
  }
}


This site uses Just the Docs, a documentation theme for Jekyll.