Skip to content

Commit fd11985

Browse files
authored
Merge pull request #21465 from celestehorgan/add-announcement
Improve announcements implementation
2 parents 220d92b + a86ab58 commit fd11985

File tree

11 files changed

+81
-32
lines changed

11 files changed

+81
-32
lines changed

config.toml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,10 @@ githubWebsiteRaw = "raw.githubusercontent.com/kubernetes/website"
8585
# param for displaying an announcement block on every page; see PR #16210
8686
announcement = false
8787
# announcement_message is only displayed when announcement = true; update with your specific message
88-
announcement_message = "The Kubernetes Documentation team would like your feedback! Please take a <a href='https://www.surveymonkey.com/r/8R237FN' target='_blank'>short survey</a> so we can improve the Kubernetes online documentation."
89-
88+
announcement_title = "Announcement title here"
89+
announcement_message_full = "Long homepage announcement <br/><br/> 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 <br/> for line breaks.
90+
announcement_message_compact = "One line compact announcement" #appears on subpages
91+
announcement_bg = "#000000" #choose a dark color – text is white
9092

9193
[params.pushAssets]
9294
css = [
@@ -313,4 +315,4 @@ contentDir = "content/uk"
313315
[languages.uk.params]
314316
time_format_blog = "02.01.2006"
315317
# A list of language codes to look for untranslated content, ordered from left to right.
316-
language_alternatives = ["en"]
318+
language_alternatives = ["en"]

content/en/_index.html

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
abstract: "Automated container deployment, scaling, and management"
44
cid: home
55
---
6-
{{< announcement >}}
7-
86
{{< deprecationwarning >}}
97

108
{{< blocks/section id="oceanNodes" >}}
@@ -60,4 +58,4 @@ <h2>The Challenges of Migrating 150+ Microservices to Kubernetes</h2>
6058

6159
{{< blocks/kubernetes-features >}}
6260

63-
{{< blocks/case-studies >}}
61+
{{< blocks/case-studies >}}

layouts/_default/baseof.html

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@
44
{{ partial "head.html" . }}
55
</head>
66
<body class="page">
7+
{{ block "announcement" . }}
8+
{{ if .IsHome }}
9+
{{ partial "frontpage-announcement.html" . }}
10+
{{ else }}
11+
{{ partial "announcement.html" . }}
12+
{{ end }}
13+
{{ end }}
714
{{ partial "header.html" . }}
815
{{ block "hero" . }}
916
<!-- HERO -->
@@ -18,7 +25,6 @@ <h5>{{ .Params.abstract }}</h5>
1825
</section>
1926
{{ block "post-hero" . }}{{ end }}
2027
{{ end }}
21-
2228
<main>
2329
<article class="page-content">
2430
{{ block "main" . }}{{ end }}
@@ -28,4 +34,4 @@ <h5>{{ .Params.abstract }}</h5>
2834
{{ partialCached "footer.html" . }}
2935
{{ partialCached "footer-scripts.html" . }}
3036
</body>
31-
</html>
37+
</html>

layouts/blog/baseof.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
<link rel="stylesheet" type="text/css" href="{{ "css/blog.css" | relURL }}">
88
</head>
99
<body>
10+
{{ partial "announcement.html" . }}
1011
{{ partial "header.html" . }}
1112
<section id="hero" class="light-text no-sub">
1213
<h1>{{ .Title }}</h1>
@@ -39,4 +40,4 @@ <h1>{{ .Title }}</h1>
3940
{{ partialCached "footer.html" . }}
4041
{{ partialCached "footer-scripts.html" . }}
4142
</body>
42-
</html>
43+
</html>

layouts/community/list.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{{ define "main" }}
22
<link rel="stylesheet" type="text/css" href="{{ "css/newcommunity.css" | relURL }}">
33
{{ .Content }}
4-
{{ end }}
4+
{{ end }}

layouts/docs/baseof.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,23 @@
44
{{ partial "head.html" . }}
55
</head>
66
<body>
7+
{{ partial "announcement.html" . }}
78
{{ partial "header.html" . }}
89
{{ block "hero" . }}
910
<!-- HERO -->
1011
<section id="hero" class="light-text no-sub">
1112
{{ partial "docs/top-menu.html" . }}
1213
</section>
1314
{{ end }}
14-
{{ block "announcement" . }}{{ partial "announcement.html" . }}{{ end }}
1515
{{ block "deprecation" . }}{{ partial "deprecation-warning.html" . }}{{ end }}
1616
<main>
1717
<section id="encyclopedia">
1818
{{ block "side-menu" . }}<div id="docsToc" style="display:none;"></div>{{ end }}
1919
<div id="{{ block "content-id" . }}docsContent{{ end }}">
2020
{{ block "content" . }}{{ end }}
21-
21+
2222
{{ partial "feedback.html" . }}
23-
23+
2424
{{ partial "git-info.html" . }}
2525
</div>
2626
</section>
@@ -45,4 +45,4 @@
4545
})();
4646
</script>
4747
</body>
48-
</html>
48+
</html>

layouts/partials/announcement.html

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1-
{{ if .Param "announcement"}}
2-
<section id="announcement">
3-
<main>
4-
<div class="content announcement">
5-
<h3>
6-
{{ .Param "announcement_message" | markdownify }}
7-
</h3>
8-
</div>
9-
</main>
10-
</section>
11-
{{ end }}
1+
{{ if .Page.Param "announcement" }}
2+
<section lang="en" id="announcement" style="background-color:{{ .Page.Param "announcement_bg" }}">
3+
<main>
4+
<div class="content announcement main-section">
5+
6+
<h4 class="announcement">
7+
{{ .Page.Param "announcement_title" | markdownify }}
8+
</h4>
9+
<p class="announcement">{{ .Page.Param "announcement_message_compact" | markdownify }}</p>
10+
11+
</div>
12+
</main>
13+
</section>
14+
{{ end }}

layouts/partials/css.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
<link rel="stylesheet" href="{{ "css/jquery-ui.min.css" | relURL }}">
2020
<link rel="stylesheet" href="{{ "css/callouts.css" | relURL }}">
2121
<link rel="stylesheet" href="{{ "css/custom-jekyll/tags.css" | relURL }}">
22+
{{- if .Site.Params.announcement }}
23+
<link rel="stylesheet" href="{{ "css/announcement.css" | relURL }}">
24+
{{- end }}
2225
{{- if .Params.deprecated }}
2326
<link rel="stylesheet" href="{{ "css/deprecation-warning.css" | relURL }}">
2427
{{- end }}
@@ -34,4 +37,4 @@
3437
{{- $url := trim . " " | relURL }}
3538
<link rel="stylesheet" href="{{ $url }}"><!-- custom css added -->
3639
{{- end }}
37-
{{- end }}
40+
{{- end }}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{{ if .Page.Param "announcement" }}
2+
<section lang="en" id="fp-announcement" style="background-color:{{ .Page.Param "announcement_bg" }}">
3+
<main>
4+
<div class="content announcement main-section">
5+
6+
<h3>
7+
{{ .Page.Param "announcement_title" | markdownify }}
8+
</h3>
9+
<p>{{ .Page.Param "announcement_message_full" | markdownify }}</p>
10+
11+
</div>
12+
</main>
13+
</section>
14+
{{ end }}

layouts/shortcodes/announcement.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
{{ if .Page.Param "announcement" }}
2+
<link rel="stylesheet" href="{{ "css/announcement.css" | relURL }}">
23
<section id="announcement">
34
<main>
4-
<div class="content announcement">
5+
<div class="content announcement main-section">
6+
57
<h3>
68
{{ .Page.Param "announcement_message" | markdownify }}
79
</h3>
10+
811
</div>
912
</main>
1013
</section>

0 commit comments

Comments
 (0)