From b22c30f127704d4d24f1684019fbe38d1cd55f3f Mon Sep 17 00:00:00 2001 From: Martin Taillefer Date: Sun, 23 Dec 2018 07:46:24 -0800 Subject: [PATCH] Add support for boilerplate text. (#3005) --- .spelling | 1 + boilerplates/en/example.md | 2 ++ .../contribute/writing-a-new-topic/index.md | 21 +++++++++++++++++++ layouts/shortcodes/boilerplate.html | 4 ++++ 4 files changed, 28 insertions(+) create mode 100644 boilerplates/en/example.md create mode 100644 layouts/shortcodes/boilerplate.html diff --git a/.spelling b/.spelling index 4ef02dac01..38e19af51c 100644 --- a/.spelling +++ b/.spelling @@ -539,6 +539,7 @@ webhook Keycloak OpenID Istioctl +Boilerplates - search.md searchresults diff --git a/boilerplates/en/example.md b/boilerplates/en/example.md new file mode 100644 index 0000000000..e5dcd47ad8 --- /dev/null +++ b/boilerplates/en/example.md @@ -0,0 +1,2 @@ +This is some boilerplate *markdown* _text_. + diff --git a/content/about/contribute/writing-a-new-topic/index.md b/content/about/contribute/writing-a-new-topic/index.md index 7e92ac78ae..78fb2206a1 100644 --- a/content/about/contribute/writing-a-new-topic/index.md +++ b/content/about/contribute/writing-a-new-topic/index.md @@ -65,6 +65,11 @@ is the best fit for your content: +### About blog posts + +The Istio blog is intended to contain authoritative posts regarding Istio and technologies or products related to +Istio. We generally do not publish user or enthusiast posts about using Istio. + ## Naming a topic Choose a title for your topic that has the keywords you want search engines to find. @@ -433,6 +438,22 @@ will use when the user chooses to download the file. For example: If you don't specify the `downloadas` attribute, then the download name is taken from the `url` attribute instead. +## Embedding boilerplate text + +You can embed common boilerplate text into any markdown output using the `boilerplate` sequence: + +{{< text markdown >}} +{{}} +{{< /text >}} + +which results in: + +{{< boilerplate example >}} + +You supply the name of a boilerplate file to insert at the current location. Boilerplates are +located in language-specific subdirectories of the `boilerplates` directory. Boilerplates are just +normal markdown files. + ## Using tabs If you have some content to display in a variety of formats, it is convenient to use a tab set and display each diff --git a/layouts/shortcodes/boilerplate.html b/layouts/shortcodes/boilerplate.html new file mode 100644 index 0000000000..ef198196ed --- /dev/null +++ b/layouts/shortcodes/boilerplate.html @@ -0,0 +1,4 @@ +{{- /* Inserts a boilerplate markdown file into the document. See https://preliminary.istio.io/about/contribute/writing-a-new-topic/#embedding-boilerplate-text for details */ -}} +{{- $path := printf "boilerplates/%s/%s.md" .Site.Language.Lang (.Get 0) -}} +{{- $markdown := readFile $path -}} +{{- markdownify $markdown }}