Creating Links in Markdown
Markdown syntax for a hyperlink is square brackets followed by parentheses. The square brackets hold the text, the parentheses hold the link.
[Link text Here](https://link-url-here.org)
Internal Links
For internal links (links to other AnVIL portal pages) we need to follow a few rules:
- Use the "relative path" to the page omitting the protocol and domain name. For example use
/guides/content/creating-links
instead ofhttps://anvilproject.org/guides/content/creating-links
. - For the link address use the
path
of the page in the site regardless of the location of the file in the repository. - Do not use the
.md
suffix. - Don't forget to start the path with a forward slash:
/
.
Putting this all together an internal link looks like:
[An Internal Link](/guides/content/editing-an-existing-page)
This renders as: An Internal Link
Linking to an Internal Page Heading
It is possible to link directly to any outline heading on an internal page as the page headings each have an anchor.
You can find out the link to a page heading by clicking on link icon that appears when you hover over a heading. After you click on the link symbol, the url to that heading will be in your browsers address bar. Copy the link and strip off the method and domain to make a relative url.
Then use the path to create a link like so:
[An Internal Link to a Section Heading](/guides/content/editing-an-existing-page#modifying-front-matter)
This renders like:
An Internal Link to a Section Heading
External Links
The markdown for external links is the same for internal links except we use the full url.
[This is an external link to genome.gov](https://www.genome.gov/)
This displays as:
This is an external link to genome.gov