Add SEO metadata partial and bump Hugo version to 0.53 (#508)

Signed-off-by: lucperkins <lucperkins@gmail.com>
This commit is contained in:
Luc Perkins
2019-01-24 09:37:29 -08:00
committed by Brian Goff
parent 4f3bd20e15
commit 8ec59f8261
17 changed files with 111 additions and 71 deletions

View File

@@ -1,11 +1,11 @@
{{- .Scratch.Set "numFigures" 1 }}
{{- $pageType := cond .IsHome "home" .Section }}
{{ .Scratch.Set "numFigures" 1 }}
{{ $pageType := cond .IsHome "home" .Section }}
<!DOCTYPE html>
<html lang="{{ .Site.LanguageCode }}">
<html lang="{{ site.LanguageCode }}">
<head>
{{ partial "meta.html" . }}
<title>
{{ block "title" . }}{{ .Site.Title }}{{ end }}
{{ block "title" . }}{{ site.Title }}{{ end }}
</title>
{{ partial "css.html" . }}
</head>

View File

@@ -1,5 +1,5 @@
{{ define "title" }}
{{ .Site.Title }} | Home
{{ site.Title }} | Home
{{ end }}
{{ define "main" }}

View File

@@ -1,16 +1,14 @@
{{- $favicon := .Site.Params.favicon }}
{{- $inServerMode := .Site.IsServer }}
{{- $includePaths := (slice "node_modules") }}
{{- $sass := "sass/style.sass" }}
{{- $cssOutput := "css/style.css" }}
{{- $devOpts := (dict "targetPath" $cssOutput "includePaths" $includePaths "enableSourceMap" true) }}
{{- $prodOpts := (dict "targetPath" $cssOutput "includePaths" $includePaths "outputStyle" "compressed") }}
{{- $cssOpts := cond $inServerMode $devOpts $prodOpts }}
{{- $css := resources.Get $sass | resources.ExecuteAsTemplate $sass . | toCSS $cssOpts }}
{{- if $inServerMode }}
{{ $inServerMode := site.IsServer }}
{{ $includePaths := (slice "node_modules") }}
{{ $sass := "sass/style.sass" }}
{{ $cssOutput := "css/style.css" }}
{{ $devOpts := (dict "targetPath" $cssOutput "includePaths" $includePaths "enableSourceMap" true) }}
{{ $prodOpts := (dict "targetPath" $cssOutput "includePaths" $includePaths "outputStyle" "compressed") }}
{{ $cssOpts := cond $inServerMode $devOpts $prodOpts }}
{{ $css := resources.Get $sass | resources.ExecuteAsTemplate $sass . | toCSS $cssOpts }}
{{ if $inServerMode }}
<link rel="stylesheet" href="{{ $css.RelPermalink }}">
{{- else }}
{{- $prodCss := $css | fingerprint }}
{{ else }}
{{ $prodCss := $css | fingerprint }}
<link rel="stylesheet" href="{{ $prodCss.RelPermalink }}" integrity="{{ $prodCss.Data.Integrity }}">
{{- end }}
<link rel="shortcut icon" href="{{ $favicon }}">
{{ end }}

View File

@@ -1,11 +1,11 @@
{{- $description := .Params.description }}
{{ $description := .Params.description }}
<section class="dashboard-main-header section has-background-dark">
<p class="title is-size-1 has-text-white-bis has-text-weight-light{{ if $description }} is-spaced{{ end }}">
{{ .Title }}
</p>
{{- with $description }}
{{ with $description }}
<p class="subtitle is-size-3 is-size-4-mobile has-text-white-bis has-text-weight-light">
{{ . }}
</p>
{{- end }}
{{ end }}
</section>

View File

@@ -1,8 +1,8 @@
{{- $sidebarLogo := .Site.Params.logos.sidebar }}
{{- $docs := where .Site.Pages "Section" "docs" }}
{{ $sidebarLogo := site.Params.logos.sidebar }}
{{ $docs := where site.Pages "Section" "docs" }}
<div class="dashboard-panel is-medium is-hidden-mobile has-background-primary">
<div class="dashboard-panel-header has-text-centered">
<a href="{{ .Site.BaseURL }}">
<a href="{{ site.BaseURL }}">
<img src="{{ $sidebarLogo }}">
</a>
</div>
@@ -11,13 +11,13 @@
<div class="dashboard-panel-main">
<div class="toc">
{{- range $docs }}
{{ range $docs }}
<div class="toc-item has-text-weight-light">
<a href="{{ .URL }}">
{{ .Title }}
</a>
</div>
{{- end }}
{{ end }}
</div>
</div>
</div>

View File

@@ -1,4 +1,4 @@
{{- $year := now.Year}}
{{ $year := now.Year}}
<footer class="footer has-background-black">
<div class="has-text-centered">
<img class="is-footer-logo" src="https://raw.githubusercontent.com/cncf/artwork/master/virtualkubelet/icon/white/virtualkubelet-icon-white.png">

View File

@@ -1,4 +1,4 @@
{{- $heroLogo := .Site.Params.logos.hero }}
{{ $heroLogo := site.Params.logos.hero }}
<div class="hero is-primary">
<div class="hero-body">
<div class="section has-text-centered">

View File

@@ -1,6 +1,6 @@
{{- $description := .Site.Params.description | markdownify }}
{{- $social := .Site.Params.social }}
{{- $providers := .Site.Data.providers }}
{{ $intro := site.Params.intro | markdownify }}
{{ $social := site.Params.social }}
{{ $providers := site.Data.providers }}
<section class="section">
<div class="container">
<div class="columns">
@@ -10,7 +10,7 @@
</p>
<span class="content is-size-4 is-size-5-mobile">
{{ $description }}
{{ $intro }}
</span>
<br /><br />
@@ -24,15 +24,15 @@
</p>
<ul>
{{- range $providers }}
{{- $url := printf "https://github.com/virtual-kubelet/virtual-kubelet/tree/master/providers/%s" .tag }}
{{ range $providers }}
{{ $url := printf "https://github.com/virtual-kubelet/virtual-kubelet/tree/master/providers/%s" .tag }}
<li class="has-bottom-spacing">
<a class="is-size-5 is-size-6-mobile has-text-grey-lighter has-text-weight-light" href="{{ $url }}" target="_blank">
{{ .name | markdownify }}
</a>
<br />
</li>
{{- end }}
{{ end }}
</ul>
</div>
</div>

View File

@@ -1,9 +1,9 @@
{{- $socialButtons := .Site.Params.social }}
{{- $repoInfo := getJSON "https://api.github.com/repos/virtual-kubelet/virtual-kubelet" }}
{{- $numStars := $repoInfo.stargazers_count }}
{{- $numWatchers := $repoInfo.subscribers_count }}
{{ $socialButtons := site.Params.social }}
{{ $repoInfo := getJSON "https://api.github.com/repos/virtual-kubelet/virtual-kubelet" }}
{{ $numStars := $repoInfo.stargazers_count }}
{{ $numWatchers := $repoInfo.subscribers_count }}
<div class="buttons">
{{- range $socialButtons }}
{{ range $socialButtons }}
<a class="button is-medium is-{{ .color }}" href="{{ .url }}" target="_blank">
<span class="icon">
<i class="fab fa-{{ .icon }}"></i>
@@ -12,7 +12,7 @@
{{ .name }}
</span>
</a>
{{- end }}
{{ end }}
</div>
<div class="buttons">

View File

@@ -1,7 +1,7 @@
{{- $jsFiles := (slice "anchor" "app") }}
{{ $jsFiles := (slice "anchor" "app") }}
<script src="https://code.jquery.com/jquery-3.3.1.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
{{- range $jsFiles }}
{{- $path := printf "js/%s.js" . }}
{{- $file := resources.Get $path | minify | fingerprint }}
{{ range $jsFiles }}
{{ $path := printf "js/%s.js" . }}
{{ $file := resources.Get $path | minify | fingerprint }}
<script src="{{ $file.RelPermalink }}" integrity="{{ $file.Data.Integrity }}"></script>
{{- end }}
{{ end }}

View File

@@ -1,2 +1,41 @@
{{ $isHome := .IsHome }}
{{ $favicon := site.Params.favicon }}
{{ $isDoc := eq .Section "docs" }}
{{ $description := .Param "description" }}
{{ $title := cond $isHome site.Title .Title }}
{{ $pageType := cond $isHome "website" "article" }}
{{ $imageUrl := site.Params.logos.site }}
{{ $twitter := (index (where site.Params.social "name" "Twitter") 0).handle }}
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no">
<link rel="canonical" content="{{ .Permalink }}">
<link rel="shortcut icon" href="{{ $favicon }}">
{{ with $description }}
<meta name="description" content="{{ . }}">
{{ end }}
<!-- OpenGraph metadata -->
<meta property="og:title" content="{{ $title }}">
{{ if $isDoc }}
<meta property="og:type" content="documentation">
{{ end }}
<meta property="og:url" content="{{ .Permalink }}">
<meta property="og:locale" content="en_US">
{{ if not $isHome }}
<meta property="og:site_name" content="{{ site.Title }}">
{{ end }}
{{ with $description }}
<meta property="og:description" content="{{ . }}">
{{ end }}
<meta name="og:type" content="{{ $pageType }}">
<meta name="og:image" content="{{ $imageUrl }}">
<meta name="og:image:alt" content="{{ site.Title }} project logo">
<meta name="og:image:type" content="image/png">
<!-- Twitter Card metadata -->
<meta name="twitter:card" content="summary">
<meta name="twitter:site" content="@{{ $twitter }}">
<meta name="twitter:creator" content="@{{ $twitter }}">
{{ .Hugo.Generator }}

View File

@@ -1,4 +1,4 @@
{{- $navbarLogo := .Site.Params.logos.navbar }}
{{ $navbarLogo := site.Params.logos.navbar }}
<nav class="navbar is-fixed-top is-primary">
<div class="container">
<div class="navbar-brand">

View File

@@ -1,11 +1,11 @@
{{- $providers := .Site.Data.providers }}
{{ $providers := site.Data.providers }}
<ul>
{{- range $providers }}
{{- $url := printf "https://github.com/virtual-kubelet/virtual-kubelet/tree/master/providers/%s" .tag }}
{{ range $providers }}
{{ $url := printf "https://github.com/virtual-kubelet/virtual-kubelet/tree/master/providers/%s" .tag }}
<li>
<a href="{{ $url }}">
{{ .name | markdownify }}
</a>
</li>
{{- end }}
{{ end }}
</ul>

View File

@@ -1,6 +1,6 @@
{{- $src := .Get "src" }}
{{- $path := printf "static/%s" $src | relURL }}
{{- $figureId := $.Page.Scratch.Get "numFigures" }}
{{ $src := .Get "src" }}
{{ $path := printf "static/%s" $src | relURL }}
{{ $figureId := $.Page.Scratch.Get "numFigures" }}
<figure id="figure-{{ $figureId }}">
{{ $path | readFile | safeHTML }}
<figcaption>