Merge pull request #30082 from sftim/20211013_revise_header_style

Revise page header styles
This commit is contained in:
Kubernetes Prow Robot
2021-11-12 20:00:46 -08:00
committed by GitHub
15 changed files with 185 additions and 149 deletions
+3 -8
View File
@@ -6,26 +6,21 @@
<body class="td-{{ .Kind }}{{- if ne .Params.cid "" -}}{{- printf " cid-%s" (lower .Params.cid) -}}{{- end -}}">
<header>
{{ partial "navbar.html" . }}
</header>
{{ block "announcement" . }}
{{ if .IsHome }}
{{ partial "frontpage-announcement.html" . }}
{{ else }}
{{ block "announcement" . }}
{{ partial "announcement.html" . }}
{{ end }}
{{ end }}
{{ block "hero" . }}
<!-- HERO -->
<section class="header-hero text-white pb-4 light-text">
<div class="main-section">
<div id="headlineWrapper">
<h1>{{ block "hero-title" . }}{{ .Params.bigheader | default .Title }}{{ end }}</h1>
<h5>{{ .Params.abstract }}</h5>
</div>
{{ block "hero-more" . }}{{ end }}
</div>
</section>
{{ block "post-hero" . }}
</header>
{{ block "deprecated" . }}
{{ if or .IsHome ( eq .Params.cid "partners" ) ( eq .Params.cid "community" ) }}
{{ partial "deprecation-warning.html" . }}
@@ -37,8 +32,8 @@
<main role="main" class="td-main">
{{ block "main" . }}{{ end }}
</main>
{{ partial "footer.html" . }}
</div>
{{ partialCached "footer.html" . }}
{{ partialCached "scripts.html" . }}
</body>
</html>
+8 -8
View File
@@ -6,15 +6,15 @@
<body class="td-search {{- if ne .Params.cid "" -}}{{- printf " cid-%s" (lower .Params.cid) -}}{{- end -}}">
<header>
{{ partial "navbar.html" . }}
<div class="header-filler"></div>
</header>
{{ block "announcement" . }}
{{ if .IsHome }}
{{ partial "frontpage-announcement.html" . }}
{{ else }}
{{ block "announcement" . }}
{{ partial "announcement.html" . }}
{{ end }}
{{ end }}
{{ block "hero" . }}
<section class="header-hero filler">
</section>
{{ block "hero-more" . }}{{ end }}
{{ end }}
</header>
<div class="td-outer">
<main role="main" class="td-main">
<section class="row td-search-result">
@@ -48,8 +48,8 @@
</div>
</section>
</main>
{{ partial "footer.html" . }}
</div>
{{ partial "footer.html" . }}
{{ partialCached "scripts.html" . }}
</body>
</html>
+3
View File
@@ -12,6 +12,7 @@
<header>
{{ partial "navbar.html" . }}
{{ partial "announcement.html" . }}
{{ block "hero" . }}
<section class="header-hero text-center text-white font-bold pb-4">
<h1>
{{ $sectionHeading := .Site.GetPage "section" .Section }}
@@ -20,6 +21,8 @@
{{ end }}
</h1>
</section>
{{ block "hero-more" . }}{{ end }}
{{ end }}
</header>
<div class="container-fluid td-outer">
<div class="td-main">
+3
View File
@@ -76,3 +76,6 @@
<a href="{{ .page.RelPermalink }}"{{ if $isForeignLanguage }} target="_blank"{{ end }}>{{ T "main_read_about"}} {{ .page.LinkTitle }}</a>
</div>
{{ end }}
{{ define "announcement" }}
<!-- skip announcement -->
{{ end }}
+6 -2
View File
@@ -8,7 +8,11 @@
<header>
{{ partial "navbar.html" . }}
{{ partial "announcement.html" . }}
<div class="header-filler"></div>
{{ block "hero" . }}
<section class="header-hero filler">
</section>
{{ block "hero-more" . }}{{ end }}
{{ end }}
</header>
<div class="container-fluid td-outer">
<div class="td-main">
@@ -41,8 +45,8 @@
</div>
</div>
</div>
{{ partial "footer.html" . }}
</div>
{{ partial "footer.html" . }}
{{ partial "scripts.html" . }}
</body>
</html>
+8 -4
View File
@@ -1,7 +1,4 @@
{{ define "main" }}
{{ if not .Params.notitle }}
<h1>{{ .Title }}</h1>
{{ end }}
{{ template "docs-portal-content" . }}
{{ end }}
@@ -19,4 +16,11 @@
</div>
</div>
</section>
{{ end }}
{{ end }}
{{ define "hero" }}
<section class="header-hero text-white pb-4 light-text ">
{{ if not .Params.notitle }}
<h1>{{ .Title }}</h1>
{{ end }}
</section>
{{ end }}
+41 -15
View File
@@ -1,17 +1,43 @@
{{ define "main" }}
<div class="td-content">
{{ $hasContent := false }}
{{ with .File }}
{{ if ne .Filename "" }}
{{ $hasContent = (ge (len $.RawContent) 100) }}
{{ end }}
{{ end }}
{{ if $hasContent }}
{{ partial "docs/content-page" (dict "ctx" $ "page" $ ) }}
{{ else }}
<h1>{{ .Title }}</h1>
{{ with .Params.description }}<div class="lead">{{ . | markdownify }}</div>{{ end }}
{{ end }}
{{ partial "section-index.html" . }}
</div>
{{- $child_of_first_section := false -}}
{{- with .Parent -}}
{{- if eq .CurrentSection .FirstSection -}}
{{- $child_of_first_section = true -}}
{{- end -}}
{{- end -}}
<div class="td-content">
{{ $hasContent := false }}
{{ with .File }}
{{ if ne .Filename "" }}
{{ $hasContent = (ge (len $.RawContent) 100) }}
{{ end }}
{{ end }}
{{ if $hasContent }}
{{- if $child_of_first_section -}}
{{ partial "docs/top-section-page" (dict "ctx" $ "page" $ ) }}
{{- else -}}
{{ partial "docs/content-page" (dict "ctx" $ "page" $ ) }}
{{- end -}}
{{ else }}
<h1>{{ .Title }}</h1>
{{ with .Params.description }}<div class="lead">{{ . | markdownify }}</div>{{ end }}
{{ end }}
{{ partial "section-index.html" . }}
</div>
{{ end }}
{{ define "hero" }}
{{- $child_of_first_section := false -}}
{{- with .Parent -}}
{{- if eq .CurrentSection .FirstSection -}}
{{- $child_of_first_section = true -}}
{{- end -}}
{{- end -}}
{{- if $child_of_first_section -}}
<section class="header-hero text-white pb-4 light-text ">
<h1>{{ .Title }}</h1>
</section>
{{- else -}}
<section class="header-hero filler">
</section>
{{- end -}}
{{ end }}
+8
View File
@@ -1,4 +1,12 @@
{{ define "main" }}
<div class="td-content">
{{ partial "docs/content-page" (dict "ctx" . "page" .) }}
</div>
{{ end }}
{{ define "hero-more" }}
{{ if .IsHome }}
{{ with site.GetPage "section" "docs/tutorials/kubernetes-basics" }}
<a href="{{ .RelPermalink }}" id="quickstartButton" class="button">{{ .LinkTitle }}</a>
{{ end }}
{{ end }}
{{ end }}
+5 -5
View File
@@ -15,18 +15,18 @@
{{- if or (eq .endTime nil ) (gt ( time .endTime ) now ) -}}
{{- if not $announcementShown -}}
{{- $announcementShown = true -}}
<section lang="en" id="announcement" style="background-color: #3371e3; color: #fff; {{ .style | safeCSS }}">
<div lang="en" id="announcement" style="background-color: #3371e3; color: #fff; {{ .style | safeCSS }}">
<aside>
<div class="content announcement main-section" data-nosnippet>
<div class="announcement-main" data-nosnippet>
{{ if .title }}
<h4 class="announcement">
<h4>
{{ .title | markdownify }}
</h4>
{{ end }}
<p class="announcement">{{ .message | markdownify }}</p>
<p>{{ .message | markdownify }}</p>
</div>
</aside>
</section>
</div>
{{- end -}}
{{- end -}}
{{- end -}}
@@ -0,0 +1 @@
{{ .page.Content }}
@@ -1,34 +0,0 @@
{{ $dateRegExp := "^[0-9]{4}-1[0-2]|0[1-9]-(?:3[01]|0[1-9]|[12][0-9])T(?:2[0-3]|[01][0-9]):(?:[0-5][0-9]):(?:60|[0-5][0-9])$" }}
{{ $announcementShown := false }}
{{ range $.Site.Data.announcements }}
{{ range .announcements }}
{{ if or ( eq .endTime nil ) ( eq .message nil ) }}
{{ errorf "Invalid announcement: %#v" . }}
{{ end }}
{{ if and (ne .startTime nil ) (lt ( len ( findRE $dateRegExp .startTime ) ) 1 ) }}
{{ errorf "Invalid announcement start time: %#v" .startTime }}
{{ end }}
{{ if lt ( len ( findRE $dateRegExp .endTime ) ) 1 }}
{{ errorf "Invalid announcement end time: %#v" .endTime }}
{{ end }}
{{ if or (eq .startTime nil ) (lt ( time .startTime ) now ) }}
{{- if or (eq .endTime nil ) (gt ( time .endTime ) now ) -}}
{{- if not $announcementShown -}}
{{- $announcementShown = true -}}
<section lang="en" id="fp-announcement" style="background-color: #3371e3; color: #fff; {{ .style | safeCSS }}">
<aside>
<div class="content announcement main-section" data-nosnippet>
{{ if .title }}
<h4 class="announcement">
{{ .title | markdownify }}
</h4>
{{ end }}
<p class="announcement">{{ .message | markdownify }}</p>
</div>
</aside>
</section>
{{- end -}}
{{- end -}}
{{- end -}}
{{ end }}
{{ end }}
+1 -1
View File
@@ -1,5 +1,5 @@
{{ $cover := .HasShortcode "blocks/cover" }}
<nav class="js-navbar-scroll navbar navbar-expand navbar-dark {{ if $cover}} td-navbar-cover {{ end }} flex-row td-navbar" data-auto-burger="primary">
<nav class="js-navbar-scroll navbar navbar-expand navbar-dark {{ if $cover}} td-navbar-cover {{ end }} flex-column flex-md-row td-navbar" data-auto-burger="primary">
<a class="navbar-brand" href="{{ .Site.Home.RelPermalink }}"></a>
<div class="td-navbar-nav-scroll ml-md-auto" id="main_navbar">