From 1c3e1a88ec961807824535e2146816c2d5b4558d Mon Sep 17 00:00:00 2001 From: Wedge Jarrad Date: Wed, 5 Jun 2024 18:21:53 -0700 Subject: [PATCH] Add examples for creating download links Fixes #17734 Relates #13940 #6069 Signed-off-by: Wedge Jarrad --- docs/features/techdocs/how-to-guides.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/docs/features/techdocs/how-to-guides.md b/docs/features/techdocs/how-to-guides.md index e47af8d1d7..d58b05b4da 100644 --- a/docs/features/techdocs/how-to-guides.md +++ b/docs/features/techdocs/how-to-guides.md @@ -874,3 +874,23 @@ metadata: TechDocs supports using the [mkdocs-redirects](https://github.com/mkdocs/mkdocs-redirects/tree/master) plugin to create a redirect map for any TechDocs site. This allows broken links from renamed or moved pages in your site to be redirected to their specified replacement. TechDocs will notify the user that the page they are trying to access is no longer maintained. Then, they will be redirected. External site redirects are not supported. If an external redirect is provided, the user will instead be redirected to the index page of the documentation site. + +## Create download links for static assets + +You may want to make files available for download by your users such as PDF +documents, images, or code templates. Download links for files included in your +docs directory can be made by adding `{: download }` after a markdown link. + +``` +[Link text](./img/foo.jpg){: download } +``` + +The user's browser will download the file as `download.jpg` when the link is +clicked. + +Specify a file name to control the name the file will be given when it is +downloaded: + +``` +[Link text](./img/foo.jpg){: download="foo.jpg" } +```