What are Paths?
All pages on your site are assigned a URL "path" which refers to the direct location of the webpage or file on your website. URL paths are sometimes referred to as a "permalink" for the page.
This path is what your visitors will use to visit that page and what your menu will link to if you add the page to the menu.
How are Paths Generated?
By default, the URL path for each content page (e.g. basic page, news articles, events, landing pages) is automatically generated based on the page title once the page is saved. In this example, the url path would be https://briantest.princeton.edu/Page-Title once the page is saved.
In some cases you may want to manually edit the path/permalink for a page. This can be done by entering/modifying the text in the "permalink" field directly beneath the title on the edit form for a page. When manually providing a path, follow some best practices:
- Use only lowercase letters
- Don't use spaces or underscores, instead use hyphens
- Exclude commas and apostrophes
- Keep the path concise
Automatically generated paths will differ depending on the content type of the page, the menu link title, and the page title.
For example, if you create a Basic Page or Landing Page titled "Graduate Program Information" with a menu link title of "Graduate Program" and place it in the menu as a child of an existing landing page titled "Academics" with menu link title "Academics", the path for the new page will become /academics/graduate-program. If you don't place pages of these types in the menu, a path for them will likely not be automatically generated and will default to the system path of /node/[node_id]. In this case you should manually enter a path that's appropriate for the page.
For content types that are never added to the menu, like News Articles and Events, the auto-generated path is derived from the name of the content type and the page title. For example, for an event titled "Commencement Celebration" the path will become /events/commencement-celebration.
How are Paths Changed?
If the path you entered was manually specified, simply edit the page and update the path to what you'd like. When manually updating the path, you may want to add a redirect that redirects the old URL to the new one. This is important if the old URL has been indexed by search engines or is linked to from other pages on your site. If you want to remove your manually specified path and have a new path automatically generated, simply clear out the custom path and save.
If the path for the page was automatically generated, it will be automatically updated if you update the menu link title (for Basic Pages or Landing Pages) or the page title (for other content types). In this case, your site will automatically generate a redirect from the old path to the new one and inform you of the change.
What are Breadcrumbs?
A breadcrumb (or "breadcrumb trail") is a secondary navigation tool to help users find their way around a website. Breadcrumbs typically appear as a "trail" of links at the top of the page to indicate to the user where the page is in the hierarchy of pages.
In terms of usability, breadcrumbs reduce the number of actions a website visitor needs to take in order to get to a higher-level page, and they improve the findability of website sections and pages.
How Breadcrumbs are Generated
Breadcrumbs are generated based on the path (or "permalink") of the page being displayed. When generating the breadcrumb for a page that's being viewed, each "level" of the path is checked to see if a page exists with that path. If so, it's added to the breadcrumb trail.
This is best explained by example.
Let's say you have 3 pages on your site:
- Page A with path /page-a
- Page B with path /page-a/page-b
- Page C with path /page-a/page-b/page-c
Someone visits Page C, which has path /page-a/page-b/page-c. When generating the breadcrumb trail, the system starts from the first level of the path and moves up, performing the following checks:
- Does a page on your site exist with path /page-a? If so, it's added to the breadcrumb trail.
- Does a page on your site exist with path /page-a/page-b? If so, it's added to the breadcrumb trail.
- Does a page on your site exist with path /page-a/page-b/page-c? If so, it's added to the breadcrumb trail.
The label used for each page in the breadcrumb trail corresponds with the menu link title for that page. If the page is not in the menu, then the title of the page is used instead.
Due to this behavior, you must remember that if you change the path of your "parent" pages to something else, you need to manually update the path of the child pages as well. If you don't the breadcrumb trail for the child pages will not include the parent page in the path.
Turning Breadcrumbs Off Site-wide
Breadcrumbs are not always necessary or useful. If you have a website that only has a single-level hierarchy or does not have many nested pages, then a breadcrumb trail is not needed. In the template system, you may turn off the breadcrumb feature.
To turn on/off breadcrumbs:
- From the admin toolbar, Go to Appearance
- Select Settings (for the theme that you're using)
- Under Breadcrumb Settings, select yes or no
- Click Save Configuration
Default Content Type Landing Pages and Breadcrumbs
Drupal's default Content Type Landing Pages (/news, /events, etc.) live in the top level of the main navigation menu. As a best practice, this means these Landing Pages should always be parent pages, and never child pages.
For example, if you set the /news default content type landing page as a child page to a Basic Page (ie "Home/About/News") the breadcrumbs for the individual News articles will always break. When this happens, please follow the work-around below.
The Work-Around to Fix Breadcrumbs for Default Content Type Landing Pages as Child Pages
If you choose to set a default content type landing page as a child page, follow the steps below to fix the breadcrumbs:
- Create a Basic Page: Create a Basic Page with the Content Type's name, ie News, Events, People. Configure this page with your content.
- Set as Child Page: Set this page as a child page to its parent page.
- Establish Redirect from Default to Basic Page: Under Configuration > Search and MetaData > URL Redirects > +Add Redirect.
For example, the default "/news" should be redirected to the basic page child you created: "about/news"
- Establish URL Alias Pattern: Under Configuration > Search and MetaData > URL Aliases > Patterns Tab > Add your prefix to Content Type Pattern Field
For example, "/news/[node:title]" would become "about/news/[node:title]"
Bulk Update Existing Content Type Detail Page Paths (optional, if necessary)
If your breadcrumbs are broken for multiple existing detail pages, you may bulk update these pages by following these steps:
- Navigate to Content
- From the Type dropdown menu, select the Content Type you'd like to update (ie, all News, all Events, all People)
- Check the top checkbox option to select all items
- From the Operations dropdown menu, select Change Value > Execute
- In Properties, select Revision Log Message.
- In the field that appears, type "Update Path Patterns" and click Next. This will update all existing detail pages automatically.