-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update link guidance to reflect current advice (#345)
* Restructured links and references page * Rewrote linking desitnation section * Fixed linting errors Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * Update linking advice - Discourage `relref` shortcode. - Prefer fully qualified URLs with version substition for https://grafana.com pages. Signed-off-by: Jack Baldry <[email protected]> * Update `doc-validator` to allow correct linking Signed-off-by: Jack Baldry <[email protected]> * Fix linting Signed-off-by: Jack Baldry <[email protected]> * Explicitly say that use of `relref` is discouraged and move reference content to Shortcodes page Co-authored-by: Isabel Matwawana <[email protected]> Signed-off-by: Jack Baldry <[email protected]> * Add examples to demonstrate how to link with version subsitution Signed-off-by: Jack Baldry <[email protected]> * Exclusively use underscores for link version substitution Signed-off-by: Jack Baldry <[email protected]> * Add example of absolute `relref` shortcode argument Closes #314. Signed-off-by: Jack Baldry <[email protected]> * Update headings Co-authored-by: Isabel Matwawana <[email protected]> Signed-off-by: Jack Baldry <[email protected]> * Clarify that heading to anchor conversion is a task performed by the writer Co-authored-by: Isabel Matwawana <[email protected]> Signed-off-by: Jack Baldry <[email protected]> * Deduplicate instruction to set front matter for pages Co-authored-by: Isabel Matwawana <[email protected]> Signed-off-by: Jack Baldry <[email protected]> * Fix substitution explanation Co-authored-by: Isabel Matwawana <[email protected]> Signed-off-by: Jack Baldry <[email protected]> * Add warning about `relref` shortcode usage Signed-off-by: Jack Baldry <[email protected]> * Demonstrate linking across pages and within the same page Co-authored-by: Isabel <[email protected]> * State that it is the source page's front matter that is used for substitution Signed-off-by: Jack Baldry <[email protected]> * Incorporate technical writer feedback Co-authored-by: Isabel <[email protected]> Co-authored-by: Ursula Kallio <[email protected]> --------- Signed-off-by: Jack Baldry <[email protected]> Co-authored-by: Isabel Matwawana <[email protected]> Co-authored-by: Isabel <[email protected]> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Ursula Kallio <[email protected]>
- Loading branch information
1 parent
a7d9dd3
commit c3b862c
Showing
8 changed files
with
224 additions
and
177 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
--- | ||
title: Links | ||
description: Understand how to link between pages. | ||
weight: 600 | ||
aliases: | ||
- /docs/writers-toolkit/write/links/ | ||
- /docs/writers-toolkit/write/references/ | ||
- /docs/writers-toolkit/writing-guide/references/ | ||
keywords: | ||
- Hugo | ||
- link | ||
- linking | ||
- links | ||
- ref | ||
- references | ||
- relref | ||
--- | ||
|
||
# Links | ||
|
||
Choose your link type based on the applicable scenario: | ||
|
||
- [Link from source content that's used in multiple projects](#link-from-source-content-thats-used-in-multiple-projects) | ||
- [Link to grafana.com pages](#link-to-grafanacom-pages) | ||
- [Link to external pages](#link-to-external-pages) | ||
- [Link to page headings](#link-to-page-headings) | ||
|
||
Although these other types of links still function, replace them with full URLs: | ||
|
||
- [Hugo `relref` shortcode](https://grafana.com/docs/writers-toolkit/write/shortcodes/#relref) | ||
|
||
## Link from source content that's used in multiple projects | ||
|
||
Use the `docs/reference` shortcode. | ||
|
||
The source is reused as described in [Reuse directories of content with Hugo mounts](https://grafana.com/docs/writers-toolkit/write/reuse-content/reuse-directories/). | ||
For more information and examples, refer to [`docs/reference` shortcode](https://grafana.com/docs/writers-toolkit/write/shortcodes/#docsreference). | ||
|
||
## Link to grafana.com pages | ||
|
||
Use a full URL with version substitution syntax (if needed). | ||
|
||
Version substitution is necessary for full URLs to link to the correct version of documentation. | ||
Usually, this is the current version of documentation. | ||
|
||
In versioned documentation, set the correct version in the root `_index.md` file for your documentation. | ||
The following YAML example merges with the existing front matter in the root `_index.md` file, and sets `GRAFANA_VERSION` to be `latest` for that page and all child pages. | ||
|
||
```yaml | ||
cascade: | ||
GRAFANA_VERSION: latest | ||
``` | ||
### Examples | ||
**Link to Grafana documentation**: | ||
Start with `https://grafana.com/docs/grafana/<GRAFANA_VERSION>/`, and add the rest of the URL path. | ||
|
||
For example, to link to the [Developers](https://grafana.com/docs/grafana/latest/developers) page with version substitution, | ||
use `https://grafana.com/docs/grafana/<GRAFANA_VERSION>/developers/`. | ||
|
||
- If you're linking from Grafana documentation, `<GRAFANA_VERSION>` is substituted with the version inferred from the page's URL. | ||
- If you're linking from other documentation, `<GRAFANA_VERSION>` is substituted with the value of `GRAFANA_VERSION` from the source page's front matter. | ||
|
||
**Link to Grafana Cloud documentation**: | ||
|
||
Grafana Cloud documentation is not versioned so no version substitution syntax is needed. | ||
Use the full URL. | ||
For example, to link to the [Author and run tests](https://grafana.com/docs/grafana-cloud/k6/author-run/) page, use `https://grafana.com/docs/grafana-cloud/k6/author-run/`. | ||
|
||
**Link to Mimir documentation**: | ||
|
||
Start with `https://grafana.com/docs/grafana/<MIMIR_VERSION>/`, and add the rest of the URL path. | ||
|
||
For example, to link to the [Release notes](https://grafana.com/docs/mimir/latest/release-notes/) page with version substitution, | ||
use `https://grafana.com/docs/mimir/<MIMIR_VERSION>/release-notes/`. | ||
|
||
- If you're linking from Mimir documentation, `<MIMIR_VERSION>` is substituted with the version inferred from the page's URL. | ||
- If you're linking from other documentation, `<MIMIR_VERSION>` is substituted with the value of `MIMIR_VERSION` from the source page's front matter. | ||
|
||
## Link to external pages | ||
|
||
Use the full URL. | ||
For example, `https://github.com`. | ||
|
||
## Link to page headings | ||
|
||
Link to a heading on a page in one of two ways. | ||
|
||
From within the same page: | ||
|
||
```markdown | ||
Read more in the [Configuration section](#configuration) of this page. | ||
``` | ||
|
||
From a different page: | ||
|
||
```markdown | ||
Read more in the [Grafana Open Source section of the Introduction page](https://grafana.com/docs/grafana/<GRAFANA_VERSION>/fundamentals/#grafana-open-source). | ||
``` | ||
|
||
To convert a heading to an anchor, make the following changes: | ||
|
||
1. Convert to lower case. | ||
1. Remove any period characters (`.`). | ||
1. Replace any character that's not a lower cased letter, a number, or an underscore (`_`) with dashes (`-`). | ||
1. Trim any preceding or proceeding dashes (`-`). | ||
1. Prefix with a `#`. | ||
|
||
The heading _Link to page headings_ becomes the anchor `#link-to-page-headings`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.