Creating links in Directory pages needs careful planning. Before you create the link, ask yourself:
- Is the page I'm linking to in the Staff, Student or Information Directory?
- No? Add a single link as normal using the Insert Sitecore Link or external link buttons
- Yes? Do a quick search of the Directory/Directories to find out which category the page you want to link to is sitting in for each Directory, eg. Blues Cafe is in Food and drink category. Then go to point 2
- Is the page I'm linking to in more than one Directory?
- No? Follow the 'Linking to a page that's only in one Directory' information below.
- Yes? Follow the 'Linking to a page that's in multiple Directories' information below.
Linking to a page that's only in ONE Directory
If you’re editing a Directory page and the page you’re going to link to only sits in one Directory, you need to use the Insert Sitecore link. This is a single link. Highlight the text, then select ‘Insert Sitecore Link’. You then need to navigate through the content folders and find the page.
For example, if you want to link to the ‘Flexible working’ page which is only in the Staff Directory, you need to open - Content - Main Site - Home - Staff Directory Home. That page is in the ‘Employment policies and procedures’ category. Once you find it, just select it and that link will be added. It does mean you need to know which category a page sits in, but a quick search of the Directory will help you find it.
Watch a demo
See how to create single links in our Directories training video (at 22.25 mins).
Linking to a page that is in multiple Directories (contextual links)
If you’re linking to another article that is cloned into more than one Directory, you need to use the Insert Contextual Sitecore Link button.
This does mean you need to find out whether that page exists in more than one Directory and a quick search on each Directory will help you know that. Generally speaking, HR pages are on the Staff Directory, so this type of link is not needed for those pages. But if you’re linking to Blues Café or another catering outlet, for example, these exist on all three Directories, so you here you need to use the contextual link button.
Here's the reason why we have to link in this way. If a user is browsing a Staff Directory page, for example, and they want to click on a link to Blues Café, we know that there are three different versions of the Blues page, one on each Directory. We don’t want the Staff Directory user to click on that link and be sent to the Blues Café page on another Directory. So this function instructs Sitecore that if a user is on one Directory they need to be sent to the version of the linked page that is on the same Directory.
To do this:
- highlight the word, let’s say it’s Blues Café that is going to become the link
- copy the text with Control ‘C’
- select the ‘Insert Contextual Sitecore link’ button
- paste the text into the Link Text field.
- find the Blues Café clone in each of the Directories folders below and select them
- Lastly, press Insert. Make sure that it is done in that order, making sure you've selected all the relevant Directories first before you press insert. It doesn’t work otherwise.
What you’ll notice is that in the Rich Text Editor box and on the Experience Editor preview, the word you’ve linked appears multiple times. That’s ok, it won’t show like this on the website when it's published.
Watch a demo
See how to create contextual links in our Directories training video (at 19.20 mins).