Anchor links, also known as jump links, let you link to specific parts of your articles. They are very useful tools to navigate longer articles so that your readers can more easily navigate the information. Here's how to create them!
How to set up the anchors
Anchors are very short snippets of invisible code with a unique identifier that you can use to link to that specific area. Here's how to set an anchor up!
You will need to use the BBCode editor for this part. If you're using the Plato/WYSIWYG editor, you can temporarily switch to it using the code button in the toolbar.
- Edit the article you want to link to and find the specific area you want links to jump to.
- Choose the name of the anchor. It needs to be unique within the article, can't contain spaces, and it's better to avoid special characters. We will use example-anchor in this guide.
- If the area is a section with a header, add the anchor in the opening header tag. For example, if the header looks like [h2]Example header[/h2], turn it into [h2|example-anchor]Example header[/h2].
- If the area doesn't have a header, use the anchor tag, like this: [anchor|example-anchor].
That's it! Repeat the process of any additional anchors you want, and remember to keep the anchor names unique within the same article. This step will not change how the article looks, but it's required before the next one.
How to link to an anchor in the same article
You might want to link to specific areas of the same article, for example to refer readers to other sections. Here's how to do it!
- Get the anchor name you want to link to.
- Use the URL tag like this: [url:#example-anchor]Link text here[/url]. Notice the # we used before the anchor; this is required, as it tells the system that it's an anchor link.
You're done! View the article, and the link will take you to the area of the article with the corresponding anchor name.
How to link from a different article
Linking from a different article is very similar, although it has a caveat. Here's how to do it:
- Get the anchor name you want to link to and the full URL of the article you want to link to.
- Use the URL tag like this: [url:https://worldanvil.com/rest-of-link#example-anchor]Link text here[/url]. Notice the # we used between the full URL and the anchor; this is required, as it tells the system that it's an anchor within the provided link.
There's a small caveat though: if the URL to the article ever changes, the link will stop working. The URL might change if you change your username or the name of the world or article.