feat: add flexsearch

This commit is contained in:
Henk Verlinde
2020-11-04 08:26:58 +01:00
parent 90cea786c1
commit 97d8e2c0e2
130 changed files with 4162 additions and 1763 deletions

View File

@ -2,8 +2,8 @@
<div class="row justify-content-center">
<div class="col-md-12 col-lg-10 col-xl-8">
<article>
<h1 class="text-center">Page not found</h1>
<p class="text-center">The page you requested could not be found.</p>
<h1 class="text-center">Page not found :(</h1>
<p class="text-center">The page you are looking for doesn't exist or has been moved.</p>
</article>
</div>
</div>

View File

View File

@ -1 +0,0 @@
<a href="{{ .Destination | safeURL }}"{{ with .Title}} title="{{ . }}"{{ end }}{{ if strings.HasPrefix .Destination "http" }} target="_blank" rel="noreferrer noopener"{{ end }}>{{ .Text | safeHTML }}</a>

View File

@ -1,6 +1,6 @@
<!doctype html>
<html lang="{{ .Site.LanguageCode | default "en" }}">
{{ block "head" . }}{{ partial "head/head.html" . }}{{ end }}
{{ partial "head/head.html" . }}
{{ if eq .Kind "home" -}}
{{ .Scratch.Set "class" "home" -}}
{{ else if eq .Kind "404" -}}
@ -13,15 +13,18 @@
{{ .Scratch.Add "class" " list" -}}
{{ end -}}
<body class="{{ .Scratch.Get "class" }}">
{{ block "header" . }}{{ partial "header/header.html" . }}{{ end }}
{{ partial "header/header.html" . }}
<div class="wrap container" role="document">
<div class="content">
{{ block "main" . }}{{ end }}
</div>
</div>
{{ if ne .Section "docs" }}
{{ block "footer" . }}{{ partial "footer/footer.html" . }}{{ end }}
{{ block "sidebar-prefooter" . }}{{ end }}
{{ block "sidebar-footer" . }}{{ end }}
{{ partial "footer/footer.html" . }}
{{ if and .IsHome .Site.Params.alert }}
{{ partial "footer/alert.html" . }}
{{ end }}
{{ block "script-footer" . }}{{ partial "footer/script-footer.html" . }}{{ end }}
{{ partial "footer/script-footer.html" . }}
</body>
</html>

10
layouts/_default/index.js Normal file
View File

@ -0,0 +1,10 @@
var docs = [
{{ range $index, $page := (where .Site.Pages "Section" "docs") -}}
{
id: {{ $index }},
title: "{{ .Title }}",
description: "{{ .Params.description }}",
href: "{{ .URL | absURL }}"
},
{{ end -}}
];

View File

@ -0,0 +1,5 @@
{{- $.Scratch.Add "index" slice -}}
{{- range .Site.RegularPages -}}
{{- $.Scratch.Add "index" (dict "title" .Title "description" .Params.description "contents" .Plain "permalink" .Permalink) -}}
{{- end -}}
{{- $.Scratch.Get "index" | jsonify -}}

View File

@ -0,0 +1,46 @@
{{ printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\" ?>" | safeHTML -}}
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xhtml="http://www.w3.org/1999/xhtml">
{{ range $i, $e := .Data.Pages -}}
{{ if ne .Params.sitemap_exclude true }}
<url>
<loc>{{ .Permalink }}</loc>{{ if not .Lastmod.IsZero }}
<lastmod>{{ safeHTML ( .Lastmod.Format "2006-01-02T15:04:05-07:00" ) }}</lastmod>{{ end }}{{ with .Sitemap.ChangeFreq }}
<changefreq>{{ . }}</changefreq>{{ end }}{{ if ge .Sitemap.Priority 0.0 }}
<priority>{{ .Sitemap.Priority }}</priority>{{ end }}{{ if .IsTranslated }}{{ range .Translations }}
<xhtml:link
rel="alternate"
hreflang="{{ .Lang }}"
href="{{ .Permalink }}"
/>{{ end }}
<xhtml:link
rel="alternate"
hreflang="{{ .Lang }}"
href="{{ .Permalink }}"
/>{{ end }}
</url>
{{ end -}}
{{ end -}}
{{ range .Sections -}}
{{ range $i, $e := .Data.Pages -}}
{{ if ne .Params.sitemap_exclude true -}}
<url>
<loc>{{ .Permalink }}</loc>{{ if not .Lastmod.IsZero }}
<lastmod>{{ safeHTML ( .Lastmod.Format "2006-01-02T15:04:05-07:00" ) }}</lastmod>{{ end }}{{ with .Sitemap.ChangeFreq }}
<changefreq>{{ . }}</changefreq>{{ end }}{{ if ge .Sitemap.Priority 0.0 }}
<priority>{{ .Sitemap.Priority }}</priority>{{ end }}{{ if .IsTranslated }}{{ range .Translations }}
<xhtml:link
rel="alternate"
hreflang="{{ .Lang }}"
href="{{ .Permalink }}"
/>{{ end }}
<xhtml:link
rel="alternate"
hreflang="{{ .Lang }}"
href="{{ .Permalink }}"
/>{{ end }}
</url>
{{ end -}}
{{ end -}}
{{ end -}}
</urlset>

View File

@ -8,8 +8,8 @@
{{ range .Data.Pages -}}
<div class="card">
<div class="card-body">
<h2 class="h3"><a class="stretched-link" href="{{ .Permalink }}">{{ .Params.title }}</a></h2>
<p>{{ .Params.lead }}</p>
<h2 class="h3"><a class="stretched-link text-body" href="{{ .Permalink }}">{{ .Params.title }}</a></h2>
<p>{{ .Params.lead | safeHTML }}</p>
{{ partial "main/blog-meta.html" . -}}
</div>
</div>

View File

@ -6,7 +6,7 @@
<h1>{{ .Title }}</h1>
{{ partial "main/blog-meta.html" . }}
</div>
<p class="lead">{{ .Params.lead }}</p>
<p class="lead">{{ .Params.lead | safeHTML }}</p>
{{ .Content }}
</article>
</div>

View File

@ -8,9 +8,9 @@
{{ range .Data.Pages -}}
<div class="card">
<div class="card-body">
<h2 class="h3"><a class="stretched-link" href="{{ .Permalink }}">{{ .Params.title }}</a></h2>
<h2 class="h3"><a class="stretched-link text-body" href="{{ .Permalink }}">{{ .Params.title }}</a></h2>
{{ if eq .Section "blog" -}}
<p>{{ .Params.lead }}</p>
<p>{{ .Params.lead | safeHTML }}</p>
{{ partial "main/blog-meta.html" . -}}
{{ end -}}
</div>

View File

@ -12,6 +12,7 @@
<h1>{{ .Title }}</h1>
<p class="lead">{{ .Params.lead | safeHTML }}</p>
{{ partial "main/headline-hash.html" .Content }}
{{ partial "main/edit-page.html" . }}
{{ partial "main/docs-navigation.html" . }}
</main>
</div>

View File

@ -2,7 +2,7 @@
Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Content-Security-Policy: default-src 'self'; img-src 'self' data:; script-src 'self'; style-src 'self'
Content-Security-Policy: default-src 'self'; manifest-src 'self'; connect-src 'self' https://stats.gethyas.com https://*.algolia.net https://*.algolianet.com https://*.algolia.io; font-src 'self'; img-src 'self' data: https://www.netlify.com; script-src 'self' 'unsafe-eval' 'nonce-dXNlcj0iaGVsbG8iLGRvbWFpbj0iaGVua3ZlcmxpbmRlLmNvbSIsZG9jdW1lbnQud3JpdGUodXNlcisiQCIrZG9tYWluKTs=' https://stats.gethyas.com; style-src 'self'
X-Frame-Options: SAMEORIGIN
Referrer-Policy: strict-origin
Feature-Policy: geolocation 'self'

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,3 @@
<div class="alert alert-primary fixed-bottom text-center" role="alert">
{{ .Site.Params.alertText | safeHTML }}
</div>

View File

@ -2,7 +2,12 @@
<div class="container">
<div class="row">
<div class="col-lg-16 text-center">
<p>{{ .Site.Params.footer | safeHTML }}</p>
<ul class="list-inline">
<!-- <li class="list-inline-item">{{ .Site.Params.footer | safeHTML }}</li> -->
<!-- <li class="list-inline-item"><a href="{{ "privacy-policy" | absURL }}">Privacy</a></li> -->
<li class="list-inline-item">This site is powered by <a href="https://gohugo.io/">Hugo</a> and the <a href="https://getdoks.org/">Doks</a> theme</li>
<!-- <li class="list-inline-item"><a href="https://gethyas.com/">This site is powered by Hyas</a></li> -->
</ul>
</div>
</div>
</div>

View File

@ -1,11 +1,18 @@
{{ $indexTemplate := resources.Get "js/index.js" -}}
{{ $index := $indexTemplate | resources.ExecuteAsTemplate "index.js" . -}}
{{ $lazysizes := resources.Get "js/vendor/lazysizes/lazysizes.min.js" -}}
{{ $flexsearch := resources.Get "js/vendor/flexsearch/dist/flexsearch.min.js" -}}
{{ if eq (hugo.Environment) "development" -}}
{{ $app := resources.Get "js/app.js" -}}
{{ $js := slice $lazysizes $app | resources.Concat "main.js" -}}
{{ $js := slice $lazysizes $flexsearch $app | resources.Concat "main.js" -}}
<script src="{{ $index.Permalink }}" defer></script>
<script src="{{ $js.Permalink }}" defer></script>
{{ else -}}
{{ $instantPage := resources.Get "js/vendor/instant.page/instantpage.js" | minify -}}
{{ $app := resources.Get "js/app.js" | minify -}}
{{ $js := slice $lazysizes $app | resources.Concat "main.js" -}}
{{ $secureJS := $js | resources.Fingerprint "sha512" -}}
<script src="{{ $secureJS.Permalink }}" integrity="{{ $secureJS.Data.Integrity }}" crossorigin="anonymous" defer></script>
{{ $js := slice $lazysizes $flexsearch $instantPage $app | resources.Concat "main.js" -}}
{{ $jsProd := $js | resources.Fingerprint "sha512" -}}
{{ $indexProd := $index | resources.Minify | resources.Fingerprint "sha512" -}}
<script src="{{ $indexProd.Permalink }}" integrity="{{ $indexProd.Data.Integrity }}" crossorigin="anonymous" defer></script>
<script src="{{ $jsProd.Permalink }}" integrity="{{ $jsProd.Data.Integrity }}" crossorigin="anonymous" defer></script>
{{ end -}}

View File

@ -1,5 +1,5 @@
<meta name="theme-color" content="{{ $.Site.Params.themeColor }}">
<link rel="apple-touch-icon" sizes="180x180" href="{{ "apple-touch-icon.png" | absLangURL }}">
<link rel="icon" type="image/png" sizes="32x32" href="{{ "favicon-32x32.png" | absLangURL }}">
<link rel="icon" type="image/png" sizes="16x16" href="{{ "favicon-16x16.png" | absLangURL }}">
<link rel="manifest" href="{{ "site.webmanifest" | absLangURL }}">
<link rel="apple-touch-icon" sizes="180x180" href="{{ "apple-touch-icon.png" | absURL }}">
<link rel="icon" type="image/png" sizes="32x32" href="{{ "favicon-32x32.png" | absURL }}">
<link rel="icon" type="image/png" sizes="16x16" href="{{ "favicon-16x16.png" | absURL }}">
<link rel="manifest" href="{{ "site.webmanifest" | absURL }}">

View File

@ -0,0 +1,93 @@
<meta property="og:title" content="{{ .Title }}">
<meta property="og:description" content="{{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end }}">
<meta property="og:type" content="{{ if .IsPage }}article{{ else }}website{{ end }}">
{{ if $.Scratch.Get "paginator" -}}
{{ $paginator := .Paginate (where .Site.RegularPages.ByDate.Reverse "Section" "blog" ) -}}
<meta property="og:url" content="{{ .Paginator.URL | absURL }}">
{{ else -}}
<meta property="og:url" content="{{ .Permalink }}">
{{ end -}}
{{ with $.Params.images -}}
{{ range first 6 . -}}
<meta property="og:image" content="{{ $.Permalink }}{{ . }}">
{{ end -}}
{{ else -}}
{{ $images := $.Resources.ByType "image" -}}
{{ $featured := $images.GetMatch "*feature*" -}}
{{ if not $featured -}}
{{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" }}
{{ end -}}
{{ with $featured -}}
<meta property="og:image" content="{{ $featured.Permalink }}"/>
{{ else -}}
{{ with $.Site.Params.images -}}
<meta property="og:image" content="{{ index . 0 | absURL }}"/>
{{ end -}}
{{ end -}}
{{ end -}}
{{ $iso8601 := "2006-01-02T15:04:05-07:00" -}}
{{ if .IsPage -}}
{{ if not .PublishDate.IsZero -}}
<meta property="article:published_time" {{ .PublishDate.Format $iso8601 | printf "content=%q" | safeHTMLAttr }}>
{{ else if not .Date.IsZero -}}
<meta property="article:published_time" {{ .Date.Format $iso8601 | printf "content=%q" | safeHTMLAttr }}>
{{ end -}}
{{ if not .Lastmod.IsZero -}}
<meta property="article:modified_time" {{ .Lastmod.Format $iso8601 | printf "content=%q" | safeHTMLAttr }}>
{{ end -}}
{{ else -}}
{{ if not .Date.IsZero -}}
<meta property="og:updated_time" {{ .Lastmod.Format $iso8601 | printf "content=%q" | safeHTMLAttr }}>
{{ end -}}
{{ end -}}
{{ with .Params.audio -}}
<meta property="og:audio" content="{{ . }}">
{{ end -}}
{{ with .Params.locale -}}
<meta property="og:locale" content="{{ . }}">
{{ end -}}
{{ with .Site.Params.title -}}
<meta property="og:site_name" content="{{ . }}">
{{ end -}}
{{ with .Params.videos -}}
{{ range . -}}
<meta property="og:video" content="{{ . | absURL }}">
{{ end -}}
{{ end -}}
{{ $permalink := .Permalink -}}
{{ $siteSeries := .Site.Taxonomies.series -}}
{{ with .Params.series -}}
{{ range $name := . -}}
{{ $series := index $siteSeries $name -}}
{{ range $page := first 6 $series.Pages -}}
{{ if ne $page.Permalink $permalink -}}
<meta property="og:see_also" content="{{ $page.Permalink }}">
{{ end -}}
{{ end -}}
{{ end -}}
{{ end -}}
{{ if .IsPage -}}
{{ range .Site.Authors -}}
{{ with .Social.facebook -}}
<meta property="article:author" content="https://www.facebook.com/{{ . }}">
{{ end -}}
{{ with .Site.Social.facebook -}}
<meta property="article:publisher" content="https://www.facebook.com/{{ . }}">
{{ end -}}
<meta property="article:section" content="{{ .Section }}">
{{ with .Params.tags -}}
{{ range first 6 . -}}
<meta property="article:tag" content="{{ . }}">
{{ end -}}
{{ end -}}
{{ end -}}
{{ end -}}
{{ with .Site.Social.facebook_admin -}}
<meta property="fb:admins" content="{{ . }}">
{{ end -}}

View File

@ -1,6 +1,4 @@
<!--
<link rel="preload" as="font" href="{{ .Site.BaseURL }}fonts/vendor/jost/Jost-400-Book.otf" type="font/otf" crossorigin>
<link rel="preload" as="font" href="{{ .Site.BaseURL }}fonts/vendor/jost/Jost-400-BookItalic.otf" type="font/otf" crossorigin>
<link rel="preload" as="font" href="{{ .Site.BaseURL }}fonts/vendor/jost/Jost-500-Medium.otf" type="font/otf" crossorigin>
<link rel="preload" as="font" href="{{ .Site.BaseURL }}fonts/vendor/jost/Jost-500-MediumItalic.otf" type="font/otf" crossorigin>
-->
<link rel="preload" as="font" href="{{ "fonts/vendor/jost/Jost-400-Book.otf" | absURL }}" type="font/otf" crossorigin>
<link rel="preload" as="font" href="{{ "fonts/vendor/jost/Jost-400-BookItalic.otf" | absURL }}" type="font/otf" crossorigin>
<link rel="preload" as="font" href="{{ "fonts/vendor/jost/Jost-500-Medium.otf" | absURL }}" type="font/otf" crossorigin>
<link rel="preload" as="font" href="{{ "fonts/vendor/jost/Jost-500-MediumItalic.otf" | absURL }}" type="font/otf" crossorigin>

View File

@ -1,11 +1 @@
{{ if isset .Site.Params "googleanalytics" -}}
<script>
(function(e,t,n,i,s,a,c){e[n]=e[n]||function(){(e[n].q=e[n].q||[]).push(arguments)}
;a=t.createElement(i);c=t.getElementsByTagName(i)[0];a.async=true;a.src=s
;c.parentNode.insertBefore(a,c)
})(window,document,"galite","script","{{ .Site.BaseURL }}js/vendor/ga-lite/ga-lite.min.js");
galite('create', '{{ $.Site.Params.googleAnalytics }}', 'auto');
galite('send', 'pageview');
</script>
{{ end -}}
<script async defer data-domain="gethyas.com" src="https://stats.gethyas.com/js/index.js"></script>

View File

@ -1,10 +1,12 @@
{{ if and (eq .Kind "section" "taxonomy" "taxonomyTerm") (ne .Section "blog" ) -}}
<meta name="robots" content="noindex, noarchive">
{{ if eq .Kind "404" -}}
<meta name="robots" content="noindex, follow">
{{ else -}}
{{ with .Params.robots -}}
<meta name="robots" content="{{ . }}">
<meta name="robots" content="{{ . }}">
{{ else -}}
<meta name="robots" content="index, follow">
<meta name="robots" content="index, follow">
<meta name="googlebot" content="index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1">
<meta name="bingbot" content="index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1">
{{ end -}}
{{ end -}}
@ -20,21 +22,29 @@
<meta name="description" content="{{ .Site.Params.description }}">
{{ end -}}
{{ with .Params.canonical -}}
<link rel="canonical" href="{{ . }}">
{{ else -}}
{{ if $.Scratch.Get "paginator" }}
<link rel="canonical" href="{{ .Paginator.URL | absURL }}">
{{ if .Paginator.HasPrev -}}
<link rel="prev" href="{{ .Paginator.Prev.URL | absURL }}">
{{ end -}}
{{ if .Paginator.HasNext -}}
<link rel="next" href="{{ .Paginator.Next.URL | absURL }}">
{{ end -}}
{{ else -}}
<link rel="canonical" href="{{ .Permalink }}">
{{ end -}}
{{ template "_internal/twitter_cards.html" . -}}
<meta name="twitter:site" content="{{ .Site.Params.twitterSite }}">
<meta name="twitter:creator" content="{{ .Site.Params.twitterCreator }}">
{{ partial "head/twitter_cards.html" . }}
<meta name="twitter:site" content="@{{ .Site.Params.twitterSite }}">
<meta name="twitter:creator" content="@{{ .Site.Params.twitterCreator }}">
{{ template "_internal/opengraph.html" . -}}
{{ partial "head/opengraph.html" . }}
<meta property="article:publisher" content="https://www.facebook.com/{{ .Site.Params.facebookPublisher }}">
<meta property="article:author" content="https://www.facebook.com/{{ .Site.Params.facebookAuthor }}">
<meta property="og:locale" content="{{ .Site.Params.ogLocale }}">
{{ range .AlternativeOutputFormats -}}
<link rel="{{ .Rel }}" type="{{ .MediaType.Type }}" href="{{ .Permalink | safeURL }}">
{{ end -}}
{{ block "head/structured-data" . }}{{ partial "head/structured-data.html" . }}{{ end }}
{{ partial "head/structured-data.html" . }}

View File

@ -4,12 +4,13 @@
{
"@context": "https://schema.org",
"@type": "Organization",
"url": "{{ .Site.BaseURL }}",
"url": "{{ "/" | absURL }}",
"name": "{{ .Site.Params.title }}",
"logo": "{{ .Site.BaseURL }}{{ .Site.Params.schemaLogo }}",
"logo": "{{ "/" | absURL }}{{ .Site.Params.schemaLogo }}",
"sameAs": [
"{{ .Site.Params.schemaTwitter | safeURL }}",
"{{ .Site.Params.schemaLinkedIn | safeURL }}"
"{{ .Site.Params.schemaLinkedIn | safeURL }}",
"{{ .Site.Params.schemaGitHub | safeURL }}"
]
}
</script>
@ -19,11 +20,12 @@
{
"@context": "https://schema.org",
"@type": "Person",
"url": "{{ .Site.BaseURL }}",
"url": "{{ "/" | absURL }}",
"name": "{{ .Site.Params.title }}",
"sameAs": [
"{{ .Site.Params.schemaTwitter | safeURL }}",
"{{ .Site.Params.schemaLinkedIn | safeURL }}"
"{{ .Site.Params.schemaLinkedIn | safeURL }}",
"{{ .Site.Params.schemaGitHub | safeURL }}"
]
}
</script>
@ -33,10 +35,10 @@
{
"@context": "https://schema.org",
"@type": "WebSite",
"url": "{{ .Site.BaseURL }}",
"url": "{{ "/" | absURL }}",
"potentialAction": {
"@type": "SearchAction",
"target": "{{ .Site.BaseURL }}?q={search_term_string}",
"target": "{{ "/" | absURL }}?q={search_term_string}",
"query-input": "required name=search_term_string"
}
}
@ -54,7 +56,7 @@
"@id": "{{ .Permalink }}"
},
"headline": "{{ .Title }}",
"image": {{ apply .Params.images "absURL" "." }},
"image": [{{ range $i, $e := .Params.images }}{{ if $i }}, {{ end }}{{ printf "%s%s" $.Permalink $e }}{{ end }}],
"datePublished": "{{ .PublishDate.Format "2006-01-02T15:04:05CET" }}",
"dateModified": "{{ .Lastmod.Format "2006-01-02T15:04:05CET" }}",
"author": {
@ -67,7 +69,7 @@
{{ if eq .Site.Params.schemaType "Organization" -}}
"logo": {
"@type": "ImageObject",
"url": "{{ .Site.BaseURL }}{{ .Site.Params.schemaLogo }}"
"url": "{{ "/" | absURL }}{{ .Site.Params.schemaLogo }}"
}
{{ end -}}
},
@ -77,16 +79,20 @@
{{ end -}}
{{ end -}}
{{ $dot := . -}}
{{ $dot.Scratch.Set "path" "" -}}
{{ $dot.Scratch.Set "breadcrumb" slice -}}
{{ $url := replace .Permalink ( printf "%s" .Site.BaseURL) "" -}}
{{ $.Scratch.Add "path" .Site.BaseURL -}}
{{ $.Scratch.Add "breadcrumb" (slice (dict "url" .Site.BaseURL "name" "home" "position" 1 )) -}}
{{ range $index, $element := split $url "/" -}}
{{ $.Scratch.Add "path" $element -}}
{{ $.Scratch.Add "path" "/" -}}
{{ range $index, $element := split $url "/" -}}
{{ $dot.Scratch.Add "path" $element -}}
{{ $.Scratch.Add "path" "/" -}}
{{ if ne $element "" -}}
{{ $.Scratch.Add "breadcrumb" (slice (dict "url" ($.Scratch.Get "path") "name" . "position" (add $index 2))) -}}
{{ end -}}
{{ $.Scratch.Add "breadcrumb" (slice (dict "url" ($.Scratch.Get "path") "name" . "position" (add $index 2))) -}}
{{ end -}}
{{ end -}}
<script type="application/ld+json">
@ -96,10 +102,8 @@
"itemListElement": [{{ range $.Scratch.Get "breadcrumb" }}{{ if ne .position 1 }},{{ end }}{
"@type": "ListItem",
"position": {{ .position }},
"item": {
"@id": "{{ .url }}",
"name": "{{ .name }}"
}
"name": "{{ .name | humanize | title }}",
"item": "{{ .url }}"
}{{ end }}]
}
</script>
</script>

View File

@ -0,0 +1,33 @@
{{ with $.Params.images -}}
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:image" content="{{ $.Permalink }}{{ index . 0 }}">
{{ else -}}
{{ $images := $.Resources.ByType "image" -}}
{{ $featured := $images.GetMatch "*feature*" -}}
{{ if not $featured -}}
{{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" -}}
{{ end -}}
{{ with $featured -}}
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:image" content="{{ $featured.Permalink }}">
{{ else -}}
{{ with $.Site.Params.images -}}
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:image" content="{{ index . 0 | absURL }}">
{{ else -}}
<meta name="twitter:card" content="summary">
{{ end -}}
{{ end -}}
{{ end -}}
<meta name="twitter:title" content="{{ .Title }}">
<meta name="twitter:description" content="{{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end }}">
{{ with .Site.Social.twitter -}}
<meta name="twitter:site" content="@{{ . }}">
{{ end -}}
{{ range .Site.Authors -}}
{{ with .twitter -}}
<meta name="twitter:creator" content="@{{ . }}">
{{ end -}}
{{ end -}}

View File

@ -1,9 +1,9 @@
<!-- <div class="header-bar fixed-top"></div> -->
<div class="header-bar fixed-top"></div>
<header class="navbar fixed-top navbar-expand-md navbar-light">
<div class="container">
<input class="menu-btn order-0" type="checkbox" id="menu-btn">
<label class="menu-icon d-md-none" for="menu-btn"><span class="navicon"></span></label>
<a class="navbar-brand order-1 order-md-0 mr-auto" href="{{ .Site.BaseURL }}">{{ .Site.Params.Title }}</a>
<a class="navbar-brand order-1 order-md-0 mr-auto text-primary" href="{{ "/" | absURL }}">{{ .Site.Params.Title }}</a>
<button id="mode" class="btn btn-link order-2 order-md-4" type="button" aria-label="Toggle mode">
<span class="toggle-dark"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-moon"><path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"></path></svg></span>
<span class="toggle-light"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-sun"><circle cx="12" cy="12" r="5"></circle><line x1="12" y1="1" x2="12" y2="3"></line><line x1="12" y1="21" x2="12" y2="23"></line><line x1="4.22" y1="4.22" x2="5.64" y2="5.64"></line><line x1="18.36" y1="18.36" x2="19.78" y2="19.78"></line><line x1="1" y1="12" x2="3" y2="12"></line><line x1="21" y1="12" x2="23" y2="12"></line><line x1="4.22" y1="19.78" x2="5.64" y2="18.36"></line><line x1="18.36" y1="5.64" x2="19.78" y2="4.22"></line></svg></span>
@ -11,7 +11,7 @@
<ul class="navbar-nav social-nav order-3 order-md-5">
{{ range .Site.Menus.social -}}
<li class="nav-item">
<a class="nav-link" href="{{ .URL | absLangURL }}" target="_blank" rel="noreferrer noopener">{{ .Pre | safeHTML }}<span class="ml-2 sr-only">{{ .Name | safeHTML }}</span></a>
<a class="nav-link" href="{{ .URL | absURL }}">{{ .Pre | safeHTML }}<span class="ml-2 sr-only">{{ .Name | safeHTML }}</span></a>
</li>
{{ end -}}
</ul>
@ -25,13 +25,19 @@
{{- $active = or $active (and (eq .Name "Guides") (eq $current.Section "guides")) -}}
{{- $active = or $active (and (eq .Name "Blog") (eq $current.Section "blog" "authors")) -}}
<li class="nav-item{{ if $active }} active{{ end }}">
<a class="nav-link" href="{{ .URL | absLangURL }}">{{ .Name }}</a>
<a class="nav-link" href="{{ .URL | absURL }}">{{ .Name }}</a>
</li>
{{ end -}}
<!--
<li class="nav-item">
<a class="nav-link" href="https://community.gethyas.com/">Community</a>
</li>
-->
</ul>
<div class="break order-6 d-md-none"></div>
<form class="navbar-form flex-grow-1 order-7 order-md-3">
<input class="form-control is-search" type="search" placeholder="Search {{ .Site.Params.Title }} docs..." aria-label="Search {{ .Site.Params.Title }} docs...">
<input id="userinput" class="form-control is-search" type="search" placeholder="Search docs..." aria-label="Search docs..." autocomplete="off">
<div id="suggestions" class="shadow bg-white rounded"></div>
</form>
</div>
</div>

View File

@ -1 +1 @@
<p><small>Posted {{ .Lastmod.Format "January 2, 2006" }} by {{ if .Params.authors -}}{{ range $index, $author := .Params.authors }}{{ if gt $index 0 }} and {{ end }}<a class="stretched-link position-relative" href="{{ "/authors/" | absURL }}{{ . | urlize }}/">{{ . }}</a>{{ end -}}{{ end -}}&nbsp;&hyphen;&nbsp;<strong>{{ .ReadingTime -}}&nbsp;min read</strong></small><p>
<p><small>Posted {{ .PublishDate.Format "January 2, 2006" }} by {{ if .Params.contributors -}}{{ range $index, $contributor := .Params.contributors }}{{ if gt $index 0 }} and {{ end }}<a class="stretched-link position-relative" href="{{ "/contributors/" | absURL }}{{ . | urlize }}/">{{ . }}</a>{{ end -}}{{ end -}}&nbsp;&hyphen;&nbsp;<strong>{{ .ReadingTime -}}&nbsp;min read</strong></small><p>

View File

@ -4,7 +4,7 @@
{{ $pages := where site.RegularPages "Section" .Section -}}
{{ with $pages.Next . -}}
<a href="{{ .Permalink }}">
<div class="card my-3">
<div class="card my-1">
<div class="card-body py-2">
&larr; {{ .Title }}
</div>
@ -13,7 +13,7 @@
{{ end -}}
{{ with $pages.Prev . -}}
<a class="ml-auto" href="{{ .Permalink }}">
<div class="card my-3">
<div class="card my-1">
<div class="card-body py-2">
{{ .Title }} &rarr;
</div>

View File

@ -0,0 +1 @@
<p class="edit-page"><a href="{{ .Site.Params.docsRepo }}blob/master/content/{{ .File.Path }}"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-edit-2"><path d="M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z"></path></svg>Edit this page on GitHub</a></p>

View File

@ -1 +1 @@
{{ . | replaceRE "(<h[2-9] id=\"([^\"]+)\".+)(</h[2-9]+>)" `${1}<a href="#${2}" class="anchor">#</a> ${3}` | safeHTML }}
{{ . | replaceRE "(<h[2-9] id=\"([^\"]+)\".+)(</h[2-9]+>)" `${1}<a href="#${2}" class="anchor" aria-hidden="true">#</a> ${3}` | safeHTML }}

View File

@ -6,7 +6,7 @@
{{ range .Children -}}
{{- $active := or ($currentPage.IsMenuCurrent "docs" .) ($currentPage.HasMenuCurrent "docs" .) -}}
{{- $active = or $active (eq .Name $currentPage.Title) -}}
<li><a class="docs-link{{ if $active }} active{{ end }}" href="{{ .URL }}">{{ .Name }}</a></li>
<li><a class="docs-link{{ if $active }} active{{ end }}" href="{{ .URL | absURL }}">{{ .Name }}</a></li>
{{ end -}}
</ul>
{{ end -}}

View File

@ -4,4 +4,4 @@ Allow: /
{{ else -}}
Disallow: /
{{ end }}
Sitemap: {{ "sitemap.xml" | absLangURL -}}
Sitemap: {{ "sitemap.xml" | absURL -}}

View File

@ -0,0 +1,4 @@
<div class="alert alert-warning d-flex" role="alert">
<div class="flex-shrink-1 alert-icon">{{ with .Get "icon" }}{{.}}{{ end }}</div>
<div class="w-100">{{ with .Get "text" }}{{ . | safeHTML }}{{ end }}</div>
</div>

View File

@ -0,0 +1,3 @@
{{ $image := .Page.Resources.GetMatch (printf "*%s*" (.Get "src")) -}}
{{ $lqip := $image.Resize $.Site.Params.lqipWidth -}}
<img class="img-simple img-fluid lazyload blur-up" src="{{ $lqip.Permalink }}" data-src="{{ $image.Permalink }}" width="{{ $image.Width }}" height="{{ $image.Height }}" {{ with .Get "alt" }}alt="{{.}}"{{ end }}>

View File

@ -17,7 +17,7 @@
{{ $imgSrcSet = (delimit $imgSrcSet ",") -}}
<figure{{ with .Get "class" }} class="{{.}}"{{ end }}>
<img class="figure-img img-fluid lazyload blur-up" data-sizes="auto" src="{{ $lqip.Permalink }}" data-srcset="{{ $imgSrcSet }}" width="{{ $image.Width }}" height="{{ $image.Height }}" {{ with .Get "alt" }}alt="{{.}}"{{ end }}>
<noscript><img class="figure-img img-fluid" sizes="100vw" srcset="{{ $imgSrcSet }}" src="{{ $image.Permalink }}" width="{{ $image.Width }}" height="{{ $image.Height }}" {{ with .Get "alt" }}alt="{{.}}"{{ end }}></noscript>
<img class="img-fluid lazyload blur-up" data-sizes="auto" src="{{ $lqip.Permalink }}" data-srcset="{{ $imgSrcSet }}" width="{{ $image.Width }}" height="{{ $image.Height }}" {{ with .Get "alt" }}alt="{{.}}"{{ end }}>
<noscript><img class="img-fluid" sizes="100vw" srcset="{{ $imgSrcSet }}" src="{{ $image.Permalink }}" width="{{ $image.Width }}" height="{{ $image.Height }}" {{ with .Get "alt" }}alt="{{.}}"{{ end }}></noscript>
{{ with .Get "caption" }}<figcaption class="figure-caption">{{ . | safeHTML }}</figcaption>{{ end }}
</figure>