You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/contributing/syntax-and-versioning-for-github-docs/using-markdown-and-liquid-in-github-docs.md
+85-5Lines changed: 85 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -186,15 +186,15 @@ These instructions are pertinent to Windows users.
186
186
{% endwindows %}{% endraw %}
187
187
```
188
188
189
-
You can define a default platform in an article's YAML frontmatter. For more information, see the [frontmatter documentation](https://github.com/github/docs/blob/main/content/README.md#frontmatter).
189
+
You can define a default platform in an article's YAML frontmatter. For more information, see "[AUTOTITLE](/contributing/syntax-and-versioning-for-github-docs/using-yaml-frontmatter#defaultplatform)."
190
190
191
191
## Tool tags
192
192
193
193
We occasionally need to write documentation for different tools ({% data variables.product.prodname_dotcom %} UI, {% data variables.product.prodname_cli %}, {% data variables.product.prodname_desktop %}, {% data variables.product.prodname_github_codespaces %}, curl, Visual Studio Code, JetBrains IDEs, {% data variables.product.prodname_importer_proper_name %} CLI, GraphQL API). Each tool may require a different set of instructions. We use tool tags to demarcate information for each tool.
194
194
195
195
On rare occasions, we will add new tools. Before adding a new tool, read "[AUTOTITLE](/contributing/syntax-and-versioning-for-github-docs/creating-tool-switchers-in-articles)." To add a new tool, add an entry to the `allTools` object in [`lib/all-tools.js`](https://github.com/github/docs/blob/main/src/tools/lib/all-tools.js) as a key-value pair. The key is the tag you'll use to refer to the tool in the article, and the value is how the tool will be identified on the tool picker at the top of the article.
196
196
197
-
You can define a default tool for an article in the YAML frontmatter. For more information, see the [frontmatter documentation](https://github.com/github/docs/blob/main/content/README.md#frontmatter).
197
+
You can define a default tool for an article in the YAML frontmatter. For more information, see "[AUTOTITLE](/contributing/syntax-and-versioning-for-github-docs/using-yaml-frontmatter#defaulttool)."
198
198
199
199
### Example usage of tool tags
200
200
@@ -343,11 +343,64 @@ If this happens, add the following CSS style to the `<table>` HTML tag:
343
343
344
344
For a current example of this usage, see "[AUTOTITLE](/actions/examples)."
345
345
346
-
## Internal links with AUTOTITLE
346
+
## Links
347
+
348
+
Links to docs in the `docs` repository must start with a product ID (like `/actions` or `/admin`) and contain the entire filepath, but not the file extension. For example, `/actions/creating-actions/about-custom-actions`.
349
+
350
+
Image paths must start with `/assets` and contain the entire filepath including the file extension. For example, `/assets/images/help/settings/settings-account-delete.png`.
351
+
352
+
The links to Markdown pages undergo some transformations on the server side to match the current page's language and version. The handling for these transformations lives in [`lib/render-content/plugins/rewrite-local-links`](https://github.com/github/docs/blob/main/src/content-render/unified/rewrite-local-links.js).
353
+
354
+
For example, if you include the following link in a content file:
355
+
356
+
```
357
+
/github/writing-on-github/creating-a-saved-reply
358
+
```
359
+
When viewed on {% data variables.product.prodname_dotcom_the_website %} docs, the link gets rendered with the language code:
For more information about links, see "[AUTOTITLE](/contributing/writing-for-github-docs/style-guide#links)."
368
+
369
+
### Permalinks
370
+
371
+
Because the site is dynamic, it does not build HTML files for each different version of an article. Instead it generates a "permalink" for every version of the article. It does this based on the article's [`versions` frontmatter](/contributing/syntax-and-versioning-for-github-docs/using-yaml-frontmatter#versions).
372
+
373
+
{% note %}
374
+
375
+
**Note**: As of early 2021, the `free-pro-team@latest` version is not included in URLs. A helper function called `lib/remove-fpt-from-path.js` removes the version from URLs.
376
+
377
+
{% endnote %}
378
+
379
+
For example, an article that is available in currently supported versions will have permalink URLs like the following:
An article that is not available in {% data variables.product.prodname_ghe_server %} will have just one permalink:
390
+
391
+
-`/en/get-started/quickstart/set-up-git`
392
+
393
+
{% note %}
394
+
395
+
**Note:** If you are a content contributor, you don't need to worry about supported versions when adding a link to a document. Following the examples above, if you want to reference an article, you can just use its relative location: `/github/getting-started-with-github/set-up-git`.
396
+
397
+
{% endnote %}
398
+
399
+
### Internal links with AUTOTITLE
347
400
348
401
When linking to another {% data variables.product.prodname_docs %} page, use standard Markdown syntax like `[]()`, but type `AUTOTITLE` instead of the page title. The {% data variables.product.prodname_docs %} application will replace `AUTOTITLE` with the title of the linked page during rendering. This special keyword is case-sensitive, so take care with your typing or the replacement will not work.
349
402
350
-
### Example usage of internal links with AUTOTITLE
403
+
####Example usage of internal links with AUTOTITLE
351
404
352
405
-`For more information, see "[AUTOTITLE](/path/to/page)."`
353
406
-`For more information, see "[AUTOTITLE](/path/to/page#section-link)."`
@@ -359,4 +412,31 @@ When linking to another {% data variables.product.prodname_docs %} page, use sta
359
412
360
413
{% endnote %}
361
414
362
-
For more information about links, see "[AUTOTITLE](/contributing/writing-for-github-docs/style-guide#links)."
415
+
### Linking to the current article in a different version of the docs
416
+
417
+
Sometimes you may want to link from an article to the same article in a different product version. For example:
418
+
419
+
- You mention some functionality that is not available for free, pro, or team plans and you want to link to the {% data variables.product.prodname_ghe_cloud %} version of the same page.
420
+
- The {% data variables.product.prodname_ghe_server %} version of an article describes a feature that shipped with that version, but site administrators can upgrade to the latest version of the feature that's in use on {% data variables.product.prodname_ghe_cloud %}.
421
+
422
+
You can link directly to a different version of the page using the `currentArticle` property. This means that the link will continue to work directly even if the article URL changes.
423
+
424
+
```markdown
425
+
{% raw %}{% ifversion fpt %}For more information, see the [{% data variables.product.prodname_ghe_cloud %} documentation](/enterprise-cloud@latest{{ currentArticle }}).{% endif %}{% endraw %}
426
+
```
427
+
428
+
### Preventing transformations
429
+
430
+
Sometimes you want to link to a Dotcom-only article in Enterprise content and you don't want the link to be Enterprise-ified. To prevent the transformation, you should include the preferred version in the path.
431
+
432
+
```markdown
433
+
"[GitHub's Terms of Service](/free-pro-team@latest/github/site-policy/github-terms-of-service)"
434
+
```
435
+
436
+
Sometimes the canonical home of content moves outside the docs site. None of the links included in [`src/redirects/lib/external-sites.json`](https://github.com/github/docs/blob/main/src/redirects/lib/external-sites.json) get rewritten. See [`contributing/redirects.md`](https://github.com/github/docs/blob/main/contributing/redirects.md) for more info about this type of redirect.
437
+
438
+
### Legacy filepaths and redirects for links
439
+
440
+
Our docs contain links that use legacy filepaths such as `/article/article-name` or `/github/article-name`. Our docs also contain links that refer to articles by past names. Both of these link types function properly because of redirects, but they are bugs.
441
+
442
+
When you add a link to an article, use the current filepath and article name.
0 commit comments