A particular, specially identified part of a page is called a page “fragment”. You can link to a fragment instead of linking to the whole page. When following a link to a page fragment, the web browser will scroll the page until that fragment is at the top of the viewport.
The basic steps
- Identify the section of the page you want to link to (set the ID).
- Create the link.
Two ways to set the fragment ID
- On the block.
- Within the WYSIWYG editor.
Setting a block’s ID
- Click on the block.
- Choose the “Design” option.
- Press the “CSS” tab.
- Enter the desired ID value in the “CSS ID” field.
- Press the “Save” button.
Setting an ID on an element in the WYSIWYG editor
- Select the element you want to identify (usually a header).
- Press the “Insert/Edit Attributes” button.
- Enter the desired ID value in the “ID” field.
- Press the “Insert” button.
- Press the “Save” button.
Note: An ID should only contain letters, numbers, and underscores, and it cannot start with a number.
Creating the fragment link
To link to a page fragment, just add a number sign and the fragment’s ID value to the end of the URL for the page. For example, if you assigned an ID value of “summary” to a fragment on a page with this url:
http://www.example.com/about
You would link to the fragment with this URL:
http://www.example.com/about#summary
Here’s how:
Highlight the text you want to turn into a link.
Click on Link To Page, which opens the Choose A Page panel.
Select the page to which you wish to link by clicking on that page’s name. The Choose A Page panel will close.
Now you need to edit the link you just inserted to add the fragment you created on the other page—
#summary
in this example. To do that, make sure the original text is still selected.Now click on the Insert/Edit Link button (since we’re editing the link). The Insert/Edit Link panel will open.
You’ll see that Link URL is already filled in with the URL you just inserted, which should look something like this:
http://www.example.com/index.php?cID=711
. At the end of that, place the fragment you created, so that it now looks like this:http://www.example.com/index.php?cID=711#summary
.Press Update to close the Insert/Edit Link panel.
Press Save to close the Edit Content panel.
Publish your changes.
Note: If you are using the WYSIWYG editor, linking to a fragment is created as an external link, even if it’s on your own site.
Note: If you are linking to a fragment of the same page that contains the link, then you can enter only the number sign and id and skip the rest of the page URL.