A common customization is to create a table of contents or an alphabetic navigation bar to make it easier for users to scroll through a large amount of content or long lists of individual items. This type of navigation typically relies on a Hash URI to scroll the user’s browser window down to that section of the page. These are also known as URI fragments or URI fragment links. The target of the hash value in the URL is typically based on the ID property of any HTML tag. Another approach is for the target to be an HTML anchor tag (<a>) that relies on the name property rather than the more traditional href property.
If you intend to create this kind of navigable content on your CONTENTdm home page or within a built-in collection landing page, then you will need to modify the document.addEventListener() stanzas in the recipe code to make sure it fires on the correct page.
To install this recipe:
- Download the JS file from the Cookbook Recipe Portal.
- Find these lines in the code:
const allCustomPages = true;
const customPage = ['']; //specify name of custom page(s) where script should run
If the script can run on all of your custom pages then make no changes to the code. If your code should run on specific custom pages, then you will need to add the name of your custom page(s) to the code. For example, if your hashtag navigation is on a page called “glossary”, then modify the above two lines to look like this:
const allCustomPages = false;
const customPage = ['glossary']; //specify name of custom page(s) where script should run