Skip to content

Commit 0ea0342

Browse files
Robert FeketeRobert Fekete
authored andcommitted
Adds banners under the main menu for doc pages
Based on the solution used on the opentelemetry site
1 parent 448aa63 commit 0ea0342

File tree

6 files changed

+59
-0
lines changed

6 files changed

+59
-0
lines changed

assets/scss/_styles_project.scss

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,37 @@ assets/scss/_styles_project.scss
6363
.tab-body {
6464
padding: 0rem;
6565
}
66+
67+
// Styling for announcement banner
68+
.menu-banner {
69+
@include media-breakpoint-up(md) {
70+
width: 100%;
71+
position: fixed;
72+
margin-left: -15px;
73+
z-index: 31;
74+
top: 4rem;
75+
}
76+
77+
//--td-pre-bg: #{adjust-color($gray-900, $lightness: -2.5%)};
78+
--td-pre-bg: black;
79+
80+
background: var(--td-pre-bg);
81+
color: var(--bs-body-color);
82+
text-align: center;
83+
height: 24px;
84+
85+
& p {
86+
// padding: 0.5rem;
87+
// margin-bottom: initial;
88+
color: white;
89+
}
90+
}
91+
92+
// Adds a padding because the announcements banner is too close to the breadcrumb
93+
header {
94+
padding-bottom: 8px;
95+
}
96+
.td-page-meta {
97+
// Adds a margin because the announcements banner is too close
98+
margin-top: 16px;
99+
}

content/announcements/_index.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
title: Announcements
3+
cascade:
4+
type: docs
5+
headless: true
6+
---
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
title: Observability Day North America
3+
expiryDate: 2024-11-15
4+
weight: -1 # top
5+
---
6+
<i class="fas fa-bullhorn"></i> Meet us at [**Observability Day North America**](https://colocatedeventsna2024.sched.com/event/1iztP/turn-the-volume-down-on-noisy-neighbors-sandor-guba-axoflow) (part of KubeCon) in Salt Lake City on November 12!

content/docs/_index.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
---
22
title: Logging operator
33
weight: 400
4+
cascade:
5+
show_banner: true
46
---
57

68
Welcome to the Logging operator documentation!

layouts/docs/baseof.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
<body class="td-{{ .Kind }}{{ with .Page.Params.body_class }} {{ . }}{{ end }}" {{ with .Page.Params.body_attribute }} {{ . | safeHTMLAttr }}{{ end }}>
77
<header>
88
{{ partial "navbar.html" . }}
9+
{{- partial "banner.html" . }} <!-- Adds announcements banner under the menu -->
910
</header>
1011
<div class="container-fluid td-outer">
1112
<div class="td-main">

layouts/partials/banner.html

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{{ if .Params.show_banner -}}
2+
{{ $announcements := site.GetPage "announcements" -}}
3+
{{ if $announcements -}}
4+
<div class="menu-banner">
5+
{{ range $announcements.RegularPages }}
6+
<div>{{ .Content }}</div>
7+
{{ end -}}
8+
</div>
9+
{{ end -}}
10+
{{ end -}}

0 commit comments

Comments
 (0)