Skip to content

Commit

Permalink
Update to Hugo 0.53 and remove all .Site references (kubernetes#12079)
Browse files Browse the repository at this point in the history
* Remove all .Site variable references

* Update Hugo version in Travis CI config and Makefile
  • Loading branch information
lucperkins authored and k8s-ci-robot committed Feb 5, 2019
1 parent 2ccb5d6 commit c6dd35b
Show file tree
Hide file tree
Showing 37 changed files with 84 additions and 84 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
DOCKER = docker
HUGO_VERSION = 0.52
HUGO_VERSION = 0.53
DOCKER_IMAGE = kubernetes-hugo
DOCKER_RUN = $(DOCKER) run --rm --interactive --tty --volume $(CURDIR):/src
NODE_BIN = node_modules/.bin
Expand Down
4 changes: 2 additions & 2 deletions layouts/blog/baseof.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ <h1>{{ .Title }}</h1>
</div>
<div class="col-xs-12 col-md-3 text">
<div class="widget-content">
{{ with .Site.Home.OutputFormats.Get "rss" -}}
<link rel="{{ .Rel }}" type="{{ .MediaType.Type }}" href="{{ .Permalink | safeURL }}" title="{{ $.Site.Title }}">
{{ with site.Home.OutputFormats.Get "rss" -}}
<link rel="{{ .Rel }}" type="{{ .MediaType.Type }}" href="{{ .Permalink | safeURL }}" title="{{ site.Title }}">
<a class="widget-link" href="{{ .Permalink | safeURL }}"> <i class="fas fa-rss fab-icon"> </i> </a>
{{ end -}}
<a class="widget-link" href="https://twitter.com/kubernetesio"> <i class="fab fa-twitter-square fab-icon"> </i> @Kubernetesio</a>
Expand Down
2 changes: 1 addition & 1 deletion layouts/blog/list.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{{ define "main" }}
{{ $pages := ($.Paginator 1).Pages }}
{{ with $.Site.Params.language_alternatives }}
{{ with site.Params.language_alternatives }}
{{ range . }}
{{ with (where $.Translations ".Lang" . ) }}
{{ $p := index . 0 }}
Expand Down
2 changes: 1 addition & 1 deletion layouts/blog/post.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<h4 class="date-header">{{ .Date.Format .Site.Params.time_format_blog }}</h4>
<h4 class="date-header">{{ .Date.Format site.Params.time_format_blog }}</h4>
<h3 class="post-title entry-title"><a href="{{ .Permalink }}">{{ .Title }}</a></h3>
{{ .Content }}
4 changes: 2 additions & 2 deletions layouts/case-studies/list.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{{ define "main" }}
{{ $pages := .Pages }}
{{ with $.Site.Params.language_alternatives }}
{{ with site.Params.language_alternatives }}
{{ range . }}
{{ with (where $.Translations ".Lang" . ) }}
{{ $p := index . 0 }}
Expand Down Expand Up @@ -65,4 +65,4 @@ <h3>{{ .Title }}</h3>
<p class="quote">"{{ .page.Params.quote | html }}"</p>
<a href="{{ .page.RelPermalink }}"{{ if $isForeignLanguage }} target="_blank"{{ end }}>{{ T "main_read_about"}} {{ .page.LinkTitle }}</a>
</div>
{{ end }}
{{ end }}
14 changes: 7 additions & 7 deletions layouts/docs/docsportal_home.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ <h4>Understand the basics</h4>

<div class="launch-card">
<h4>Try Kubernetes</h4>

<p>Follow tutorials to learn how to deploy applications in Kubernetes.</p>
<br>
<ul>
Expand All @@ -53,7 +53,7 @@ <h4>Try Kubernetes</h4>

<div class="launch-card">
<h4>Set up a cluster</h4>

<p>Get Kubernetes running based on your resources and needs.</p>
<br>
<ul>
Expand All @@ -70,7 +70,7 @@ <h4>Set up a cluster</h4>

<div class="launch-card">
<h4>Learn how to use Kubernetes</h4>

<p>Look up common tasks and how to perform them using a short sequence of steps.</p>
<br>
<ul>
Expand All @@ -86,7 +86,7 @@ <h4>Learn how to use Kubernetes</h4>

<div class="launch-card">
<h4>Look up reference information</h4>

<p>Browse terminology, command line syntax, API resource types, and setup tool documentation.</p>
<br>
<ul>
Expand All @@ -102,7 +102,7 @@ <h4>Look up reference information</h4>

<div class="launch-card">
<h4>Contribute to the docs</h4>

<p>Anyone can contribute, whether you’re new to the project or you’ve been around a long time.</p>
<br>
<ul>
Expand All @@ -118,7 +118,7 @@ <h4>Contribute to the docs</h4>

<div class="launch-card">
<h4>Download Kubernetes</h4>

<p>If you are installing Kubernetes or upgrading to the newest version, refer to the current release notes.</p>
<br>
<ul>
Expand All @@ -130,7 +130,7 @@ <h4>Download Kubernetes</h4>

<div class="launch-card">
<h4>About the documentation</h4>

<p>This website contains documentation for the current and previous 4 versions of Kubernetes.</p>
<br>
<ul>
Expand Down
4 changes: 2 additions & 2 deletions layouts/docs/glossary.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ <h1>{{ .Title }}</h1>
<div id="tag-container">
<p>Filter terms according to their tags:</p>
<div class="tag-description invisible" id="placeholder">.</div>
{{ range (index .Site.Data "canonical-tags") }}
{{ range (index site.Data "canonical-tags") }}
<div class="tag-description hide" id="{{ printf "tag-%s-description" .id }}">
<i>{{ .description }}</i>
</div>
{{ end }}
{{ $sorted_tags := sort (index .Site.Data "canonical-tags") "name" }}
{{ $sorted_tags := sort (index site.Data "canonical-tags") "name" }}
{{ range $sorted_tags }}
{{ $full_tag_name := printf "tag-%s" .id }}
<span id="{{ $full_tag_name }}" class="tag-option canonical-tag" data-target="{{ $full_tag_name }}">
Expand Down
6 changes: 3 additions & 3 deletions layouts/index.headers
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{{- if eq (getenv "HUGO_ENV") "production" }}
{{- $cssFilesFromConfig := .Site.Params.pushAssets.css -}}
{{- $jsFilesFromConfig := .Site.Params.pushAssets.js -}}
{{- $pages := .Site.RegularPages -}}
{{- $cssFilesFromConfig := site.Params.pushAssets.css -}}
{{- $jsFilesFromConfig := site.Params.pushAssets.js -}}
{{- $pages := site.RegularPages -}}
Link: </images/favicon.png>; rel=preload; as=image
{{- range $cssFilesFromConfig -}}
{{- $cssUrl := printf "/css/%s.css" . }}
Expand Down
2 changes: 1 addition & 1 deletion layouts/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ <h5 style="text-align: center"><a href="https://us10.campaign-archive.com/home/?


{{ define "hero-more" }}
{{ with .Site.GetPage "section" "docs/tutorials/kubernetes-basics" }}
{{ with site.GetPage "section" "docs/tutorials/kubernetes-basics" }}
<a href="{{ .RelPermalink }}" id="quickstartButton" class="button">{{ .LinkTitle }}</a>
{{ end }}
{{ end }}
14 changes: 7 additions & 7 deletions layouts/index.rss.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>{{ .Site.Title }} – {{ .Title }}</title>
<title>{{ site.Title }} – {{ .Title }}</title>
<link>{{ .Permalink }}</link>
<description>The Kubernetes project blog</description>
<generator>Hugo -- gohugo.io</generator>{{ with .Site.LanguageCode }}
<language>{{.}}</language>{{end}}{{ with .Site.Author.email }}
<managingEditor>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</managingEditor>{{end}}{{ with .Site.Author.email }}
<webMaster>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</webMaster>{{end}}{{ with .Site.Copyright }}
<generator>Hugo -- gohugo.io</generator>{{ with site.LanguageCode }}
<language>{{.}}</language>{{end}}{{ with site.Author.email }}
<managingEditor>{{.}}{{ with site.Author.name }} ({{.}}){{end}}</managingEditor>{{end}}{{ with site.Author.email }}
<webMaster>{{.}}{{ with site.Author.name }} ({{.}}){{end}}</webMaster>{{end}}{{ with site.Copyright }}
<copyright>{{.}}</copyright>{{end}}{{ if not .Date.IsZero }}
<lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }}
<image>
Expand All @@ -17,12 +17,12 @@
{{ with .OutputFormats.Get "RSS" }}
{{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }}
{{ end }}
{{ range first 50 (where .Site.RegularPages "Type" "in" (slice "blog")) }}
{{ range first 50 (where site.RegularPages "Type" "in" (slice "blog")) }}
<item>
<title>{{ .Section | title }}: {{ .Title }}</title>
<link>{{ .Permalink }}</link>
<pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
{{ with .Site.Author.email }}<author>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</author>{{end}}
{{ with site.Author.email }}<author>{{.}}{{ with site.Author.name }} ({{.}}){{end}}</author>{{end}}
<guid>{{ .Permalink }}</guid>
<description>
{{ $img := (.Resources.ByType "image").GetMatch "*featured*" }}
Expand Down
4 changes: 2 additions & 2 deletions layouts/partials/blog/archive.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{ $pages := .CurrentSection.Pages }}
{{ with $.Site.Params.language_alternatives }}
{{ with site.Params.language_alternatives }}
{{ range . }}
{{ with (where $.CurrentSection.Translations ".Lang" . ) }}
{{ $p := index . 0 }}
Expand Down Expand Up @@ -28,4 +28,4 @@ <h4 class="panel-title">
</div>
</div>
{{ end }}
</div>
</div>
2 changes: 1 addition & 1 deletion layouts/partials/deprecation-warning.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<h3>
Kubernetes {{ .Param "version" }}
{{ T "deprecation_warning" }}
<a href="{{ .Site.Params.currentUrl }}">{{ T "latest_version" }}</a>
<a href="{{ site.Params.currentUrl }}">{{ T "latest_version" }}</a>
</h3>
</div>
</main>
Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/docs/browse.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
{{ define "docs-browse-section" }}
{{ $pages := .page.Pages }}
{{ $sections := .page.Sections }}
{{ with $.ctx.Site.Params.language_alternatives }}
{{ with site.Params.language_alternatives }}
{{ range . }}
{{ with (where $.page.Translations ".Lang" . ) }}
{{ $p := index . 0 }}
Expand Down
6 changes: 3 additions & 3 deletions layouts/partials/docs/glossary-terms.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{{ $glossaryBundle := .Site.GetPage "page" "docs/reference/glossary" }}
{{ $glossaryBundle := site.GetPage "page" "docs/reference/glossary" }}
{{- if $glossaryBundle -}}
{{ $pages := $glossaryBundle.Resources.ByType "page" }}
{{- range $.Site.Params.language_alternatives -}}
{{- range site.Params.language_alternatives -}}
{{- with (where $glossaryBundle.Translations ".Lang" . ) -}}
{{ $p := (index . 0) }}
{{ $pages = $pages | lang.Merge ($p.Resources.ByType "page") }}
{{ end }}
{{ end }}
{{- $.Scratch.Set "glossary_items" $pages -}}
{{- else -}}
{{- errorf "[%s] Glossary Bundle not found for language. Create at least an index.md file inside docs/reference/glossary" .Page.Site.Language.Lang -}}
{{- errorf "[%s] Glossary Bundle not found for language. Create at least an index.md file inside docs/reference/glossary" site.Language.Lang -}}
{{- end -}}
4 changes: 2 additions & 2 deletions layouts/partials/docs/side-menu.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
{{ $p := . }}
{{ .Scratch.Set "section" .CurrentSection }}
{{ .Scratch.Set "sectionFound" false }}
{{ $docs := .Site.GetPage "section" "docs" }}
{{ $docs := site.GetPage "section" "docs" }}
{{ if ne .CurrentSection $docs }}
{{ range $docs.Sections }}
{{ if not ($.Scratch.Get "sectionFound") }}
Expand All @@ -21,4 +21,4 @@
{{ partialCached "tree.html" $section $section.RelPermalink }}
</div> <!-- /pi-accordion -->
<button class="push-menu-close-button" onclick="kub.toggleToc()"></button>
</div> <!-- /docsToc -->
</div> <!-- /docsToc -->
4 changes: 2 additions & 2 deletions layouts/partials/docs/top-menu.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{{ $p := . }}
{{ $home := .Site.Home }}
{{ $docs := .Site.GetPage "section" "docs" }}
{{ $home := site.Home }}
{{ $docs := site.GetPage "section" "docs" }}
{{ $menuSections := (where $docs.Sections ".Params.main_menu" true) }}
{{ range $menuSections }}
{{ if $p.IsDescendant . }}
Expand Down
6 changes: 3 additions & 3 deletions layouts/partials/footer.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<footer>
<main class="light-text">
<nav>
{{ with $.Site.GetPage "page" "docs/tutorials/stateless-application/hello-minikube" }}<a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a>{{ end }}
{{ with site.GetPage "page" "docs/tutorials/stateless-application/hello-minikube" }}<a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a>{{ end }}
{{ $sections := slice "docs/home" "blog" "partners" "community" "case-studies" }}
{{ range $sections }}
{{ with $.Site.GetPage "section" . }}<a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a>{{ end }}
{{ with site.GetPage "section" . }}<a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a>{{ end }}
{{ end }}
</nav>
<div class="social">
Expand All @@ -19,7 +19,7 @@
<a href="https://calendar.google.com/calendar/embed?src=nt2tcnbtbied3l6gi2h29slvc0%40group.calendar.google.com" class="calendar"><span>{{ T "community_events_calendar" }}</span></a>
</div>
<div>
{{ with .Site.GetPage "page" "/docs/setup/pick-right-solution/" }}<a href="{{ .RelPermalink }}" class="button">{{ .LinkTitle }}</a>{{ end }}
{{ with site.GetPage "page" "/docs/setup/pick-right-solution/" }}<a href="{{ .RelPermalink }}" class="button">{{ .LinkTitle }}</a>{{ end }}
<a href="https://git.k8s.io/community/contributors/guide" class="button">{{ T "main_contribute" }}</a>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/git-info.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
{{ end }}
{{ end }}
{{ if not .Params.noedit }}
<a href="https://github.com/kubernetes/website/edit/master/content/{{ .Site.Language.Lang }}/{{ .File.Path }}" class="button issue">{{ T "main_edit_this_page" }}</a>
<a href="https://github.com/kubernetes/website/edit/master/content/{{ site.Language.Lang }}/{{ .File.Path }}" class="button issue">{{ T "main_edit_this_page" }}</a>
{{ end }}
</div>
{{ if and (not .Params.showcommit) $.GitInfo }}
Expand Down
4 changes: 2 additions & 2 deletions layouts/partials/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
gtag('config', 'UA-36037335-10');
</script>
<meta charset="utf-8">
<title>{{ if .Title }}{{ .Title }} - {{ end }}{{ .Site.Title }}</title>
<title>{{ if .Title }}{{ .Title }} - {{ end }}{{ site.Title }}</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="shortcut icon" type="image/png" href="{{ "images/favicon.png" | relURL }}">
{{ partial "css.html" . }}
Expand All @@ -23,7 +23,7 @@
<meta property="og:title" content="{{ if .Params.title }}{{ .Title }}{{ else }}{{ .Summary | truncate 10 }}{{ end }}">
<meta name="twitter:title" content="{{ if .Params.title }}{{ .Title }}{{ else }}{{ .Summary | truncate 10 }}{{ end }}">
<!-- Alt text for the site image -->
<meta name="twitter:image:alt" content="{{ .Site.Title }}">
<meta name="twitter:image:alt" content="{{ site.Title }}">
{{ if $isBlogPost }}
{{ with findRE "<img.*?>" .Content 1 }}
<meta property="og:image" content="{{ index . 0 | replaceRE ".*src=\"(.+?)\".*" "$1" }}">
Expand Down
14 changes: 7 additions & 7 deletions layouts/partials/header.html
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<div id="cellophane" onclick="kub.toggleMenu()"></div>

<header>
<a href="{{ .Site.Home.RelPermalink }}" class="logo"></a>
<a href="{{ site.Home.RelPermalink }}" class="logo"></a>

<div class="nav-buttons" data-auto-burger="primary">
<ul class="global-nav">
{{ $sections := slice "docs" "blog" "partners" "community" "case-studies" }}
{{ range $sections }}
{{ with $.Site.GetPage "section" . }}<li><a href="{{ .RelPermalink }}"{{ if eq .Section $.Section }} class="active"{{ end}}>{{ .LinkTitle }}</a></li>{{ end }}
{{ with site.GetPage "section" . }}<li><a href="{{ .RelPermalink }}"{{ if eq .Section $.Section }} class="active"{{ end}}>{{ .LinkTitle }}</a></li>{{ end }}
{{ end }}
{{/* Link directly to documentation etc., if possible. */}}
{{ $langPage := cond (gt (len .Translations) 0) . .Site.Home }}
{{ $langPage := cond (gt (len .Translations) 0) . site.Home }}
<li>
<a href="#">
{{ $langPage.Language.LanguageName }} <span class="ui-icon ui-icon-carat-1-s"></span>
Expand All @@ -24,16 +24,16 @@

<li>
<a href="#">
{{ .Site.Params.version }} <span class="ui-icon ui-icon-carat-1-s"></span>
{{ site.Params.version }} <span class="ui-icon ui-icon-carat-1-s"></span>
</a>
<ul>
{{ range .Site.Params.versions }}
{{ range site.Params.versions }}
<li><a href="{{ .url }}">{{ .version }}</a></li>
{{ end }}
</ul>
</li>
</ul>
{{ with .Site.GetPage "section" "docs/tutorials/kubernetes-basics" }}
{{ with site.GetPage "section" "docs/tutorials/kubernetes-basics" }}
<a href="{{ .RelPermalink }}" class="button" id="tryKubernetes" data-auto-burger-exclude>{{ .LinkTitle }}</a>
{{ end }}

Expand All @@ -42,7 +42,7 @@

<nav id="mainNav">
<main data-auto-burger="primary">
{{ range .Site.Menus.main }}
{{ range site.Menus.main }}
<div class="nav-box">
<h3><a href="{{ .URL }}">{{ .Title }}</a></h3>
{{ .Post }}
Expand Down
8 changes: 4 additions & 4 deletions layouts/partials/templates/feature-state.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@
<b>FEATURE STATE:</b> <code>Kubernetes {{ $for_k8s_version }}</code>
{{/* docs/templates is a Hugo page bundle */}}
{{ $templates_path := "docs/templates" }}
{{ $templates := .page.Site.GetPage "page" $templates_path }}
{{ $templates := site.GetPage "page" $templates_path }}
{{ with $templates.Resources }}
{{ $template_path := printf "**feature-state-%s*" $state }}
{{ $content_template := .GetMatch $template_path }}
{{ with $content_template }}
{{ $dialog := dict "page" $content_template "for_k8s_version" $for_k8s_version "width" $width }}
{{ partial "templates/feature-dialog.html" $dialog }}
{{ else }}
{{ errorf "[%s] template not found in %s" .page.Site.Language.Lang $template_path }}
{{ errorf "[%s] template not found in %s" site.Language.Lang $template_path }}
{{ end }}
{{ else }}
{{ errorf "[%s] templates not found in docs/templates" .page.Site.Language.Lang }}
{{ errorf "[%s] templates not found in docs/templates" site.Language.Lang }}
{{ end }}
</div>
</div>
4 changes: 2 additions & 2 deletions layouts/partials/tree.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{{ template "section-tree-nav" (dict "ctx" . "section" .) }}
{{ define "section-tree-nav" }}
{{ $pages := (union .section.Pages .section.Sections) }}
{{ with $.ctx.Site.Params.language_alternatives }}
{{ with site.Params.language_alternatives }}
{{ range . }}
{{ with (where $.section.Translations ".Lang" . ) }}
{{ $p := index . 0 }}
Expand Down Expand Up @@ -34,4 +34,4 @@
{{ define "section-tree-nav-page" }}
{{ $isForeignLanguage := (ne .page.Lang $.ctx.Lang)}}
<a class="item" {{ if $isForeignLanguage }}target="_blank" {{ end }}data-title="{{ .page.LinkTitle }}{{ if $isForeignLanguage }} <small>({{ .page.Lang | upper }})</small>{{ end }}" href="{{ .page.RelPermalink }}"></a>
{{ end }}
{{ end }}
Loading

0 comments on commit c6dd35b

Please sign in to comment.