Anchors in a page allow are a great way to help segment a page with a large piece of content and by linking to these anchors, you allow the user to quickly jump through sections of the same page or linking to a specific section in a different page.
There are 2 steps to this, first we create the anchor, and then we link to it:
Create an Anchor
2. Give your anchor a name. Here are some guidelines for naming the anchor:
3. If you're creating an external anchor link, be sure to copy or remember the name you're giving the anchor.
Link to Anchor in Same Page
Use this method if your anchor and link are in different components within the same page.
- Select the element you want to turn into a link.
- Then click on the chain link icon to the left of the flag.
- Type the pound sign (#) followed by the anchor name you used when you created it and Save.
Link to Anchor in another Page
4. Select the page from the dropdown
5. After selecting the page, Drupal will have changed the URL to its numerical equivalent, e.g., "node/10".
6. After the path, type "#" followed by the anchor name you created in the first section of this page.
Link to Anchor from a Button or URL Field (Components)
2. Select the page from the dropdown, this will give you the Name of the page followed by the ID of it, e.g., Academics (421).
3. Because we don't have the URL in the format we need it, we have to create it, copy the ID number and replace the content of the field with the following: "/node/____", where the blank space needs to be filled in withe the ID.
4. After the path, type "#" followed by the anchor name you created in the first section of this page.