From d549942636064e244411f9af83dfab0b08952590 Mon Sep 17 00:00:00 2001 From: aimeeu Date: Mon, 9 Sep 2019 16:22:55 -0500 Subject: [PATCH] Add announcement shortcode and partial (#16210) Add shortcode, partial, and css so we can display an accouncement site-wide. Create a shortcode for use in content/en/ _index.html so announcement is displayed on website landing page. Create a partial for use in layouts/docs/baseof.html so announcement is displaye on every page in '/docs/home' directory. Add two values to config.toml: announcement (boolean) for toggling display of announcement; announcement_message, which is the actual message. Signed-off-by: Aimee Ukasick --- config.toml | 5 +++++ content/en/_index.html | 1 + layouts/docs/baseof.html | 3 ++- layouts/partials/announcement.html | 11 +++++++++++ layouts/shortcodes/announcement.html | 11 +++++++++++ static/css/announcement.css | 6 ++++++ 6 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 layouts/partials/announcement.html create mode 100644 layouts/shortcodes/announcement.html create mode 100644 static/css/announcement.css diff --git a/config.toml b/config.toml index ff7ed73138..9cd287d00a 100644 --- a/config.toml +++ b/config.toml @@ -78,6 +78,11 @@ nextUrl = "https://kubernetes-io-vnext-staging.netlify.com/" githubWebsiteRepo = "github.com/kubernetes/website" githubWebsiteRaw = "raw.githubusercontent.com/kubernetes/website" +# param for displaying an announcement block on every page; see PR #16210 +announcement = false +# announcement_message is only displayed when announcement = true; update with your specific message +announcement_message = "The Kubernetes Documentation team would like your feedback! Please take a short survey so we can improve the Kubernetes online documentation." + [[params.versions]] fullversion = "v1.15.0" version = "v1.15" diff --git a/content/en/_index.html b/content/en/_index.html index 7813606b80..39e9796be0 100644 --- a/content/en/_index.html +++ b/content/en/_index.html @@ -3,6 +3,7 @@ title: "Production-Grade Container Orchestration" abstract: "Automated container deployment, scaling, and management" cid: home --- +{{< announcement >}} {{< deprecationwarning >}} diff --git a/layouts/docs/baseof.html b/layouts/docs/baseof.html index 39fc908057..11342585f1 100644 --- a/layouts/docs/baseof.html +++ b/layouts/docs/baseof.html @@ -11,12 +11,13 @@ {{ partial "docs/top-menu.html" . }} {{ end }} + {{ block "announcement" . }}{{ partial "announcement.html" . }}{{ end }} {{ block "deprecation" . }}{{ partial "deprecation-warning.html" . }}{{ end }}
{{ block "side-menu" . }}{{ end }}
{{ block "content" . }}{{ end }} - + {{ partial "feedback.html" . }} {{ partial "git-info.html" . }} diff --git a/layouts/partials/announcement.html b/layouts/partials/announcement.html new file mode 100644 index 0000000000..33f6f1c86c --- /dev/null +++ b/layouts/partials/announcement.html @@ -0,0 +1,11 @@ +{{ if .Param "announcement"}} +
+
+
+

+ {{ .Param "announcement_message" | markdownify }} +

+
+
+
+{{ end }} \ No newline at end of file diff --git a/layouts/shortcodes/announcement.html b/layouts/shortcodes/announcement.html new file mode 100644 index 0000000000..b1b0ef0c2b --- /dev/null +++ b/layouts/shortcodes/announcement.html @@ -0,0 +1,11 @@ +{{ if .Page.Param "announcement" }} +
+
+
+

+ {{ .Page.Param "announcement_message" | markdownify }} +

+
+
+
+{{ end }} \ No newline at end of file diff --git a/static/css/announcement.css b/static/css/announcement.css new file mode 100644 index 0000000000..2819cba501 --- /dev/null +++ b/static/css/announcement.css @@ -0,0 +1,6 @@ +.announcement { + padding: 20px; + margin: 20px 0; + border-radius: 3px; + background-color: #eeeeee; +} \ No newline at end of file