summaryrefslogtreecommitdiff
path: root/layouts
diff options
context:
space:
mode:
Diffstat (limited to 'layouts')
-rw-r--r--layouts/_default/baseof.html41
-rw-r--r--layouts/_default/list.html0
-rw-r--r--layouts/_default/single.html0
-rw-r--r--layouts/partials/footer.html3
-rw-r--r--layouts/partials/head/css.html10
-rw-r--r--layouts/partials/head/js.html17
-rw-r--r--layouts/partials/head/meta.html22
-rw-r--r--layouts/partials/head/seo.html50
-rw-r--r--layouts/partials/header.html7
-rw-r--r--layouts/partials/navmenu.html45
10 files changed, 195 insertions, 0 deletions
diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html
new file mode 100644
index 0000000..3ca9201
--- /dev/null
+++ b/layouts/_default/baseof.html
@@ -0,0 +1,41 @@
+<!DOCTYPE html>
+<html lang="{{ site.Language.LanguageCode }}" dir="{{ or site.Language.LanguageDirection `ltr` }}">
+ <head>
+ <meta charset="UTF-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <title>{{ block "title" . }}{{ if .Title }}{{ .Title }} | {{ end }}{{ site.Title }}{{ end }}</title>
+
+ {{- with .Description }}
+ <meta name="description" content="{{ . }}">
+ {{- else }}
+ {{- if or .IsPage .IsSection}}
+ <meta name="description" content="{{ .Summary | plainify | default (printf "%s - %s" .Title site.Title) }}">
+ {{- else }}
+ <meta name="description" content="{{ site.Params.description | default site.Title }}">
+ {{- end }}
+ {{- end }}
+
+ <meta name="generator" content="Hugo {{ hugo.Version }}">
+ <link rel="canonical" href="{{ .Permalink }}">
+
+ {{- if .IsTranslated }}
+ {{ range .Translations }}
+ <link rel="alternate" hreflang="{{ .Lang }}" href="{{ .Permalink }}">
+ {{ end }}
+ {{- end }}
+
+ {{ partial "head/meta.html" . }}
+ {{ partial "head/seo.html" . }}
+ {{ partialCached "head/css.html" . }}
+ </head>
+
+ <body class="{{ .Type | default "page" }} {{ .Lang }}">
+ {{ partial "header.html" . }}
+
+ <main id="main" role="main">
+ {{ block "main" . }}{{ end }}
+ </main>
+
+ {{ partial "footer.html" . }}
+ </body>
+</html>
diff --git a/layouts/_default/list.html b/layouts/_default/list.html
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/layouts/_default/list.html
diff --git a/layouts/_default/single.html b/layouts/_default/single.html
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/layouts/_default/single.html
diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html
new file mode 100644
index 0000000..a74a6a4
--- /dev/null
+++ b/layouts/partials/footer.html
@@ -0,0 +1,3 @@
+<footer role="contentinfo">
+ <p>&copy; {{ now.Year }} {{ site.Params.author.name }}</p>
+</footer>
diff --git a/layouts/partials/head/css.html b/layouts/partials/head/css.html
new file mode 100644
index 0000000..8e6c145
--- /dev/null
+++ b/layouts/partials/head/css.html
@@ -0,0 +1,10 @@
+{{- with resources.Get "css/main.css" }}
+ {{- if hugo.IsDevelopment }}
+ <link rel="stylesheet" href="{{ .RelPermalink }}">
+ {{- else }}
+ {{- with . | minify | fingerprint }}
+ <link rel="stylesheet" href="{{ .RelPermalink }}" integrity="{{ .Data.Integrity }}" crossorigin="anonymous">
+ {{- end }}
+ {{- end }}
+{{- end }}
+
diff --git a/layouts/partials/head/js.html b/layouts/partials/head/js.html
new file mode 100644
index 0000000..6123e7f
--- /dev/null
+++ b/layouts/partials/head/js.html
@@ -0,0 +1,17 @@
+{{- with resources.Get "js/main.js" }}
+ {{- $opts := dict
+ "minify" (not hugo.IsDevelopment)
+ "sourceMap" (cond hugo.IsDevelopment "external" "")
+ "targetPath" "js/main.js"
+ }}
+ {{- with . | js.Build $opts }}
+ {{- if hugo.IsDevelopment }}
+ <script src="{{ .RelPermalink }}"></script>
+ {{- else }}
+ {{- with . | fingerprint }}
+ <script src="{{ .RelPermalink }}" integrity="{{ .Data.Integrity }}" crossorigin="anonymous"></script>
+ {{- end }}
+ {{- end }}
+ {{- end }}
+{{- end }}
+
diff --git a/layouts/partials/head/meta.html b/layouts/partials/head/meta.html
new file mode 100644
index 0000000..d0358a1
--- /dev/null
+++ b/layouts/partials/head/meta.html
@@ -0,0 +1,22 @@
+<!-- Basic Meta -->
+<meta name="author" content="{{ site.Params.author.name | default site.Title }}">
+<meta name="robots" content="index, follow">
+
+<!-- Open Graph (OG) -->
+<meta property="og:title" content="{{ .Title | default site.Title }}">
+<meta property="og:description" content="{{ .Description | default .Summary }}">
+<meta property="og:type" content="{{ if .IsHome }}website{{ else }}article{{ end }}">
+<meta property="og:url" content="{{ .Permalink }}">
+<meta property="og:site_name" content="{{ site.Title }}">
+{{- with .Params.images }}
+ <meta property="og:image" content="{{ (index . 0) | absURL }}">
+{{- end }}
+
+<!-- Twitter Card -->
+<meta name="twitter:card" content="summary_large_image">
+<meta name="twitter:title" content="{{ .Title | default site.Title }}">
+<meta name="twitter:description" content="{{ .Description | default .Summary }}">
+{{- with .Params.images }}
+ <meta name="twitter:image" content="{{ (index . 0) | absURL }}">
+{{- end }}
+
diff --git a/layouts/partials/head/seo.html b/layouts/partials/head/seo.html
new file mode 100644
index 0000000..2c617e1
--- /dev/null
+++ b/layouts/partials/head/seo.html
@@ -0,0 +1,50 @@
+{{ if .IsPage }}
+ <script type="application/ld+json">
+ {
+ "@context": "https://schema.org",
+ "@type": "Article",
+ "headline": {{ printf "%q" .Title }},
+ "datePublished": "{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}",
+ {{ with .Lastmod }}
+ "dateModified": "{{ .Format "2006-01-02T15:04:05Z07:00" }}",
+ {{ end }}
+ "author": {
+ "@type": "Person",
+ "name": {{ printf "%q" (site.Params.author.name | default site.Title) }}
+ },
+ "publisher": {
+ "@type": "Person",
+ "name": {{ printf "%q" site.Title }},
+ "logo": {
+ "@type": "ImageObject",
+ "url": "{{ site.Params.logo | absURL }}"
+ }
+ },
+ "mainEntityOfPage": {
+ "@type": "WebPage",
+ "@id": "{{ .Permalink }}"
+ },
+ "image": [
+ {{ with .Params.images }}"{{ (index . 0) | absURL }}"{{ end }}
+ ]
+ }
+ </script>
+{{ else if .IsHome }}
+ <script type="application/ld+json">
+ {
+ "@context": "https://schema.org",
+ "@type": "WebSite",
+ "url": "{{ site.BaseURL }}",
+ "name": {{ printf "%q" site.Title }},
+ "author": {
+ "@type": "Person",
+ "name": {{ printf "%q" (site.Params.author.name | default site.Title) }}
+ },
+ "publisher": {
+ "@type": "Person",
+ "name": {{ printf "%q" site.Title }}
+ }
+ }
+ </script>
+{{ end }}
+
diff --git a/layouts/partials/header.html b/layouts/partials/header.html
new file mode 100644
index 0000000..a496628
--- /dev/null
+++ b/layouts/partials/header.html
@@ -0,0 +1,7 @@
+<header role="banner">
+ <a href="{{ site.Home.RelPermalink }}" rel="home" class="site-title">
+ {{ site.Title }}
+ </a>
+
+ {{ partial "navmenu.html" (dict "menuID" "main" "page" .) }}
+</header>
diff --git a/layouts/partials/navmenu.html b/layouts/partials/navmenu.html
new file mode 100644
index 0000000..05fd64f
--- /dev/null
+++ b/layouts/partials/navmenu.html
@@ -0,0 +1,45 @@
+{{- /*
+Renders a menu for the given menu ID.
+
+@context {page} page The current page.
+@context {string} menuID The menu ID.
+
+@example: {{ partial "navmenu.html" (dict "menuID" "main" "page" .) }}
+*/}}
+
+{{- $page := .page }}
+{{- $menuID := .menuID }}
+
+{{- with index site.Menus $menuID }}
+ <nav role="navigation" aria-label="{{ i18n "mainNavigation" | default "Main navigation" }}">
+ <ul>
+ {{ range . }}
+ {{- $attrs := dict "href" .URL }}
+ {{- if $page.IsMenuCurrent .Menu . }}
+ {{- $attrs = merge $attrs (dict "class" "active" "aria-current" "page") }}
+ {{- else if $page.HasMenuCurrent .Menu .}}
+ {{- $attrs = merge $attrs (dict "class" "ancestor" "aria-current" "true") }}
+ {{- end }}
+ {{- $name := .Name }}
+ <!-- Translations -->
+ {{- with .Identifier }}
+ {{- with T . }}
+ {{- $name = . }}
+ {{- end }}
+ {{- end }}
+ <li>
+ <a
+ {{- range $k, $v := $attrs }}
+ {{- with $v }}
+ {{- printf " %s=%q" $k $v | safeHTMLAttr }}
+ {{- end }}
+ {{- end -}}
+ >
+ {{ $name }}
+ </a>
+ </li>
+ {{- end }}
+ </ul>
+ </nav>
+{{- end }}
+