From 9caa83d75bd3b25f3400dc43425c8faf2da00e30 Mon Sep 17 00:00:00 2001 From: Celeste Horgan Date: Thu, 4 Jun 2020 14:20:16 -0700 Subject: [PATCH] Improve announcements implementation Signed-off-by: Celeste Horgan Co-authored-by: Tim Bannister --- config.toml | 8 ++++-- content/en/_index.html | 4 +-- layouts/_default/baseof.html | 10 +++++-- layouts/blog/baseof.html | 3 +- layouts/community/list.html | 2 +- layouts/docs/baseof.html | 8 +++--- layouts/partials/announcement.html | 25 +++++++++-------- layouts/partials/css.html | 5 +++- layouts/partials/frontpage-announcement.html | 14 ++++++++++ layouts/shortcodes/announcement.html | 5 +++- static/css/announcement.css | 29 ++++++++++++++++---- 11 files changed, 81 insertions(+), 32 deletions(-) create mode 100644 layouts/partials/frontpage-announcement.html diff --git a/config.toml b/config.toml index 4acaa66e953..2c23e1e9168 100644 --- a/config.toml +++ b/config.toml @@ -83,10 +83,12 @@ 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 = true # 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." - +announcement_title = "Announcement title here" +announcement_message_full = "Long homepage announcement

Quisque efficitur feugiat neque non accumsan. Sed sed massa pharetra, suscipit mauris ut, viverra felis. Sed id ullamcorper sapien. Vivamus lobortis elementum nunc nec molestie. Ut eleifend tellus diam, in tincidunt purus ullamcorper nec. Morbi quam elit, laoreet at cursus vitae, efficitur condimentum felis. Nam ac felis sed lorem dapibus semper. Integer eu pretium justo. Nunc porta pulvinar ornare. " #appears on homepage. Use md formatting for links and
for line breaks. +announcement_message_compact = "One line compact announcement" #appears on subpages +announcement_bg = "#000000" #choose a dark color – text is white [params.pushAssets] css = [ diff --git a/content/en/_index.html b/content/en/_index.html index f54851f05db..f389669d032 100644 --- a/content/en/_index.html +++ b/content/en/_index.html @@ -3,8 +3,6 @@ title: "Production-Grade Container Orchestration" abstract: "Automated container deployment, scaling, and management" cid: home --- -{{< announcement >}} - {{< deprecationwarning >}} {{< blocks/section id="oceanNodes" >}} @@ -60,4 +58,4 @@ Kubernetes is open source giving you the freedom to take advantage of on-premise {{< blocks/kubernetes-features >}} -{{< blocks/case-studies >}} +{{< blocks/case-studies >}} \ No newline at end of file diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index d23a1141a3a..67caf96358f 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -4,6 +4,13 @@ {{ partial "head.html" . }} + {{ block "announcement" . }} + {{ if .IsHome }} + {{ partial "frontpage-announcement.html" . }} + {{ else }} + {{ partial "announcement.html" . }} + {{ end }} + {{ end }} {{ partial "header.html" . }} {{ block "hero" . }} @@ -18,7 +25,6 @@ {{ block "post-hero" . }}{{ end }} {{ end }} -
{{ block "main" . }}{{ end }} @@ -28,4 +34,4 @@ {{ partialCached "footer.html" . }} {{ partialCached "footer-scripts.html" . }} - + \ No newline at end of file diff --git a/layouts/blog/baseof.html b/layouts/blog/baseof.html index c774f688f66..c8538f971a7 100644 --- a/layouts/blog/baseof.html +++ b/layouts/blog/baseof.html @@ -7,6 +7,7 @@ + {{ partial "announcement.html" . }} {{ partial "header.html" . }}

{{ .Title }}

@@ -39,4 +40,4 @@ {{ partialCached "footer.html" . }} {{ partialCached "footer-scripts.html" . }} - + \ No newline at end of file diff --git a/layouts/community/list.html b/layouts/community/list.html index 27f7c9e382f..a9eb9f73ce5 100644 --- a/layouts/community/list.html +++ b/layouts/community/list.html @@ -1,4 +1,4 @@ {{ define "main" }} {{ .Content }} -{{ end }} +{{ end }} \ No newline at end of file diff --git a/layouts/docs/baseof.html b/layouts/docs/baseof.html index cb3071f5f57..ab75f412853 100644 --- a/layouts/docs/baseof.html +++ b/layouts/docs/baseof.html @@ -4,6 +4,7 @@ {{ partial "head.html" . }} + {{ partial "announcement.html" . }} {{ partial "header.html" . }} {{ block "hero" . }} @@ -11,16 +12,15 @@ {{ 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" . }}
@@ -45,4 +45,4 @@ })(); - + \ No newline at end of file diff --git a/layouts/partials/announcement.html b/layouts/partials/announcement.html index 33f6f1c86cf..e1af1f18c8f 100644 --- a/layouts/partials/announcement.html +++ b/layouts/partials/announcement.html @@ -1,11 +1,14 @@ -{{ if .Param "announcement"}} -
-
-
-

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

-
-
-
-{{ end }} \ No newline at end of file +{{ if .Page.Param "announcement" }} +
+
+
+ +

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

+

{{ .Page.Param "announcement_message_compact" | markdownify }}

+ +
+
+
+{{ end }} diff --git a/layouts/partials/css.html b/layouts/partials/css.html index 5b85f9409ab..20b949497c8 100644 --- a/layouts/partials/css.html +++ b/layouts/partials/css.html @@ -19,6 +19,9 @@ +{{- if .Site.Params.announcement }} + +{{- end }} {{- if .Params.deprecated }} {{- end }} @@ -34,4 +37,4 @@ {{- $url := trim . " " | relURL }} {{- end }} -{{- end }} +{{- end }} \ No newline at end of file diff --git a/layouts/partials/frontpage-announcement.html b/layouts/partials/frontpage-announcement.html new file mode 100644 index 00000000000..8cf15f88bd2 --- /dev/null +++ b/layouts/partials/frontpage-announcement.html @@ -0,0 +1,14 @@ +{{ if .Page.Param "announcement" }} +
+
+
+ +

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

+

{{ .Page.Param "announcement_message_full" | markdownify }}

+ +
+
+
+{{ end }} diff --git a/layouts/shortcodes/announcement.html b/layouts/shortcodes/announcement.html index b1b0ef0c2b5..66455dc3470 100644 --- a/layouts/shortcodes/announcement.html +++ b/layouts/shortcodes/announcement.html @@ -1,10 +1,13 @@ {{ if .Page.Param "announcement" }} +
-
+
+

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

+
diff --git a/static/css/announcement.css b/static/css/announcement.css index 2819cba501b..77ba911e5e2 100644 --- a/static/css/announcement.css +++ b/static/css/announcement.css @@ -1,6 +1,25 @@ -.announcement { - padding: 20px; - margin: 20px 0; - border-radius: 3px; - background-color: #eeeeee; +.announcement.content { + margin-bottom: 0px; +} + +.announcement > p, .gridPage #announcement .content p, .announcement > h4, .announcement > h3 { + color: #ffffff; +} + +#announcement { + padding-top: 75px; + padding-bottom: 25px; +} + +#hero { + padding-top: 40px; +} + +#fp-announcement { + min-height: 30vh; +} + +#fp-announcement main { + margin-top: 125px; + padding-bottom: 35px; } \ No newline at end of file