Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add announcement shortcode and partial so the docs can display an announcement #16210

Merged
merged 1 commit into from
Sep 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 <a href='https://www.surveymonkey.com/r/8R237FN' target='_blank'>short survey</a> so we can improve the Kubernetes online documentation."

[[params.versions]]
fullversion = "v1.15.0"
version = "v1.15"
Expand Down
1 change: 1 addition & 0 deletions content/en/_index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
abstract: "Automated container deployment, scaling, and management"
cid: home
---
{{< announcement >}}

{{< deprecationwarning >}}

Expand Down
3 changes: 2 additions & 1 deletion layouts/docs/baseof.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@
{{ partial "docs/top-menu.html" . }}
</section>
{{ end }}
{{ block "announcement" . }}{{ partial "announcement.html" . }}{{ end }}
{{ block "deprecation" . }}{{ partial "deprecation-warning.html" . }}{{ end }}
<section id="encyclopedia">
{{ block "side-menu" . }}<div id="docsToc" style="display:none;"></div>{{ end }}
<div id="{{ block "content-id" . }}docsContent{{ end }}">
{{ block "content" . }}{{ end }}

{{ partial "feedback.html" . }}

{{ partial "git-info.html" . }}
Expand Down
11 changes: 11 additions & 0 deletions layouts/partials/announcement.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{{ if .Param "announcement"}}
<section id="announcement">
<main>
<div class="content announcement">
<h3>
{{ .Param "announcement_message" | markdownify }}
</h3>
</div>
</main>
</section>
{{ end }}
11 changes: 11 additions & 0 deletions layouts/shortcodes/announcement.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{{ if .Page.Param "announcement" }}
<section id="announcement">
<main>
<div class="content announcement">
<h3>
{{ .Page.Param "announcement_message" | markdownify }}
</h3>
</div>
</main>
</section>
{{ end }}
6 changes: 6 additions & 0 deletions static/css/announcement.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.announcement {
padding: 20px;
margin: 20px 0;
border-radius: 3px;
background-color: #eeeeee;
}