diff options
author | Paul Bakker <paul@brainspark.nl> | 2019-11-10 00:26:28 +0300 |
---|---|---|
committer | Paul Bakker <paul@brainspark.nl> | 2019-11-10 00:26:28 +0300 |
commit | 2cc6eff3314e4770ff2b6b03635ad65d262aa8ad (patch) | |
tree | 14f7bfcc315ac0fa68ee9b410738866dd04733b5 /layouts |
First upload of flexible SEO Hugo theme
Diffstat (limited to 'layouts')
24 files changed, 292 insertions, 0 deletions
diff --git a/layouts/404.html b/layouts/404.html new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/layouts/404.html diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html new file mode 100644 index 0000000..ecc5280 --- /dev/null +++ b/layouts/_default/baseof.html @@ -0,0 +1,14 @@ +<!DOCTYPE html> +<html lang="{{ .Lang }}" itemscope itemtype="http://schema.org/WebPage"> + <head> + {{- partial "head.html" . -}} + </head> + <body> + {{- partial "nav.html" . -}} + {{- block "header" . }}{{- partial "header.html" . -}}{{ end }} + <div id="content"> + {{- block "main" . }}{{- end }} + </div> + {{- partial "footer.html" . -}} + </body> +</html> diff --git a/layouts/_default/single.html b/layouts/_default/single.html new file mode 100644 index 0000000..de17d92 --- /dev/null +++ b/layouts/_default/single.html @@ -0,0 +1,11 @@ +{{ define "main" }} +<div class="container" role="main"> + <div class="row"> + <div class="py-5 text-center"> + <article> + {{ .Content }} + </article> + </div> + </div> +</div> +{{ end }} diff --git a/layouts/_default/term.html b/layouts/_default/term.html new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/layouts/_default/term.html diff --git a/layouts/index.html b/layouts/index.html new file mode 100644 index 0000000..ccb8f7e --- /dev/null +++ b/layouts/index.html @@ -0,0 +1,11 @@ +{{ define "main" }} + <div role="main" class="container"> + <div class="row"> + <div class="py-5 text-center"> + {{ with .Content }} + {{.}} + {{ end }} + </div> + </div> + </div> +{{ end }} diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html new file mode 100644 index 0000000..442aa08 --- /dev/null +++ b/layouts/partials/footer.html @@ -0,0 +1,9 @@ +{{- $footer_type := .Site.Params.Footer | default "simple" }} +{{- $footer_file := printf "footers/%s.html" $footer_type }} +{{- partial $footer_file . }} + +<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script> +<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script> +<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script> + +{{- partial "footer_custom.html" . }} diff --git a/layouts/partials/footer_custom.html b/layouts/partials/footer_custom.html new file mode 100644 index 0000000..e123130 --- /dev/null +++ b/layouts/partials/footer_custom.html @@ -0,0 +1,4 @@ +<!-- +If you want to include any custom html just before </body>, put it in /layouts/partials/footer_custom.html +Do not put anything in this file - it's only here so that hugo won't throw an error if /layouts/partials/footer_custom.html doesn't exist. +--> diff --git a/layouts/partials/footers/simple.html b/layouts/partials/footers/simple.html new file mode 100644 index 0000000..ddd92f9 --- /dev/null +++ b/layouts/partials/footers/simple.html @@ -0,0 +1,21 @@ + <footer class="my-5 pt-5 text-muted text-center text-small"> + <p class="mb-1">© + {{- if .Site.Params.since }} + {{ .Site.Params.since }} - + {{- end }} + {{ .Site.LastChange.Format "2006" }} + + {{- if .Site.Author.name }} + {{- if .Site.Author.website }} + <a href="{{ .Site.Author.website }}">{{ .Site.Author.name }}</a> + {{- else }} + {{ .Site.Author.name }} + {{- end }} + {{- end }} + </p> + <ul class="list-inline"> + {{- range $link, $name := .Site.Params.footerLinks }} + <li class="list-inline-item"><a href="{{ $link }}">{{ $name }}</a></li> + {{- end }} + </ul> + </footer> diff --git a/layouts/partials/head.html b/layouts/partials/head.html new file mode 100644 index 0000000..545afdd --- /dev/null +++ b/layouts/partials/head.html @@ -0,0 +1,38 @@ +{{- if eq .Kind "home" }} + {{- $.Scratch.Set "Description" ( .Site.Params.description | default "The main page" ) }} + {{- $.Scratch.Set "Title" .Site.Title }} +{{- else }} + {{- $.Scratch.Set "Description" ( .Description | default .Params.subtitle | default .Summary | default .Kind ) }} + {{- $.Scratch.Set "Title" ( .Title | default .Site.Title ) }} +{{- end }} + + <meta charset="utf-8" /> + <meta http-equiv="X-UA-Compatible" content="IE=edge"> + <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0"> + +<!-- Site Title, Description, Author, and Favicon --> +{{- with ($.Scratch.Get "Title") }} + <title>{{ print . }} - {{ $.Site.Title }}</title> +{{- end }} +{{- with ($.Scratch.Get "Description") }} + <meta name="description" content="{{ . }}"> +{{- end }} +{{- with .Site.Author.name }} + <meta name="author" content="{{ . }}"/> +{{- end }} +{{- with .Site.Params.favicon }} + <link href='{{ . | absURL }}' rel='icon' type='image/x-icon'/> +{{- end -}} + +<!-- SEO --> +{{- partial "seo/main.html" . }} + +<!-- Social Media Tags --> +{{- partial "social/main.html" . }} + +<!-- Links and stylesheets --> + <link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous"> + <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous"> + +{{- partial "head_custom.html" . }} +{{ template "_internal/google_analytics_async.html" . }} diff --git a/layouts/partials/head_custom.html b/layouts/partials/head_custom.html new file mode 100644 index 0000000..554494a --- /dev/null +++ b/layouts/partials/head_custom.html @@ -0,0 +1,4 @@ +<!-- +If you want to include any custom html just before </head>, put it in /layouts/partials/head_custom.html +Do not put anything in this file - it's only here so that hugo won't throw an error if /layouts/partials/head_custom.html doesn't exist. +--> diff --git a/layouts/partials/header.html b/layouts/partials/header.html new file mode 100644 index 0000000..5913ae2 --- /dev/null +++ b/layouts/partials/header.html @@ -0,0 +1,3 @@ +{{- $header_type := .Site.Params.Header | default "simple" }} +{{- $header_file := printf "headers/%s.html" $header_type }} +{{- partial $header_file . }} diff --git a/layouts/partials/headers/simple.html b/layouts/partials/headers/simple.html new file mode 100644 index 0000000..cf5c400 --- /dev/null +++ b/layouts/partials/headers/simple.html @@ -0,0 +1,6 @@ + <div class="py-5 text-center"> + <h2>{{ .Title }}</h2> + {{- with .Params.subtitle }} + <p class="lead">{{ . }}</p> + {{- end }} + </div> diff --git a/layouts/partials/nav.html b/layouts/partials/nav.html new file mode 100644 index 0000000..b76b3cc --- /dev/null +++ b/layouts/partials/nav.html @@ -0,0 +1,3 @@ +{{- $nav_type := .Site.Params.Nav | default "simple" }} +{{- $nav_file := printf "navs/%s.html" $nav_type }} +{{- partial $nav_file . }} diff --git a/layouts/partials/navs/simple.html b/layouts/partials/navs/simple.html new file mode 100644 index 0000000..36ffd66 --- /dev/null +++ b/layouts/partials/navs/simple.html @@ -0,0 +1,13 @@ +<div class="d-flex flex-column flex-md-row align-items-center p-3 px-md-4 mb-3 bg-white border-bottom shadow-sm"> + <h5 class="my-0 mr-md-auto font-weight-normal"> + <a class="text-decoration-none" href="{{ "" | absLangURL }}">{{ .Site.Title }}</a></h5> + <nav class="my-2 my-md-0 mr-md-3"> +{{ range .Site.Menus.main.ByWeight }} + {{ if .HasChildren }} + NO HANDLING FOR CHILDREN + {{ else }} + <a class="p-2 text-dark" title="{{ .Name }}" href="{{ .URL | relLangURL }}">{{ .Name }}</a> + {{ end }} +{{ end }} + </nav> +</div> diff --git a/layouts/partials/seo/main.html b/layouts/partials/seo/main.html new file mode 100644 index 0000000..bbf7e6d --- /dev/null +++ b/layouts/partials/seo/main.html @@ -0,0 +1 @@ +{{- partial "seo/schema" . }} diff --git a/layouts/partials/seo/schema.html b/layouts/partials/seo/schema.html new file mode 100644 index 0000000..a44260d --- /dev/null +++ b/layouts/partials/seo/schema.html @@ -0,0 +1,6 @@ +{{- partial "seo/structured/website" . }} +{{- partial "seo/structured/organization" . }} +{{- if .IsPage }} +{{- partial "seo/structured/breadcrumb" . }} +{{- partial "seo/structured/article" . }} +{{- end }} diff --git a/layouts/partials/seo/structured/article.html b/layouts/partials/seo/structured/article.html new file mode 100644 index 0000000..b828456 --- /dev/null +++ b/layouts/partials/seo/structured/article.html @@ -0,0 +1,28 @@ +<script type="application/ld+json"> +{ + "@context": "http://schema.org", + "@type": "Article", + "author": { + "name" : "{{ if .Params.author -}}{{ .Params.author }}{{- else if .Site.Author.name -}}{{ .Site.Author.name }}{{- end }}" + }, + "headline": "{{ .Title }}", + "description" : "{{ if .Description }}{{ .Description | plainify }}{{ else }}{{if .IsPage}}{{ .Summary | plainify }}{{ end }}{{ end }}", + "inLanguage" : "{{ .Lang }}", + "wordCount": {{ .WordCount }}, + "datePublished" : "{{ .PublishDate.Format "2006-01-02T15:04:05" }}", + "dateModified" : "{{ .Date.Format "2006-01-02T15:04:05" }}", + "image" : "{{ .Site.Params.logo | absURL }}", + "keywords" : [ "{{ range $i, $e := .Params.tags }}{{ if $i }}, {{ end }}{{ $e }}{{ end }}" ], + "mainEntityOfPage" : "{{ .Permalink }}", + "publisher" : { + "@type": "Organization", + "name" : "{{ .Site.BaseURL }}", + "logo" : { + "@type" : "ImageObject", + "url" : "{{ .Site.Params.logo | absURL }}", + "height" : 60 , + "width" : 60 + } + } +} +</script>
\ No newline at end of file diff --git a/layouts/partials/seo/structured/breadcrumb.html b/layouts/partials/seo/structured/breadcrumb.html new file mode 100644 index 0000000..81ac41b --- /dev/null +++ b/layouts/partials/seo/structured/breadcrumb.html @@ -0,0 +1,21 @@ +<script type="application/ld+json"> +{ + "@context": "http://schema.org", + "@type": "BreadcrumbList", + "itemListElement": [{ + "@type": "ListItem", + "position": 1, + "item": { + "@id": "{{ .Site.BaseURL }}", + "name": "home" + } + },{ + "@type": "ListItem", + "position": 3, + "item": { + "@id": "{{ .Permalink }}", + "name": "{{ .Title | humanize }}" + } + }] +} +</script>
\ No newline at end of file diff --git a/layouts/partials/seo/structured/organization.html b/layouts/partials/seo/structured/organization.html new file mode 100644 index 0000000..c397e9c --- /dev/null +++ b/layouts/partials/seo/structured/organization.html @@ -0,0 +1,12 @@ +<script type="application/ld+json"> +{ + "@context": "http://schema.org", + "@type": "Organization", + "name": "{{ .Site.Params.organizationName }}", + "url": "{{ .Site.BaseURL }}" + {{- with .Site.Params.socialProfiles }}, "sameAs": {{ . }}{{- end }} + {{- with .Site.Params.organizationLogo }}, "logo": "{{ . }}"{{- end }} + {{- with .Site.Params.organizationAddress }}, "address": "{{ . }}"{{- end }} + {{- with .Site.Data.organization.contacts.contactPoint }}, "contactPoint": {{ . }}{{- end }} +} +</script> diff --git a/layouts/partials/seo/structured/post.html b/layouts/partials/seo/structured/post.html new file mode 100644 index 0000000..f1a10da --- /dev/null +++ b/layouts/partials/seo/structured/post.html @@ -0,0 +1,47 @@ +<script type="application/ld+json"> { + "@context" : "http://schema.org", + "@type" : "BlogPosting", + {{ if .Params.categories }}{{ range .Params.categories }}"articleSection" : "{{ . }}",{{ end }}{{ end }} + "name" : "{{ .Title | safeJS }}", + "headline" : "{{ .Title | safeJS }}", + "mainEntityOfPage": { + "@type": "WebPage", + "@id": "{{ .Permalink }}" + }, + "description" : "{{ if .Description }}{{ .Description | plainify }}{{ else }}{{if .IsPage}}{{ .Summary | plainify }}{{ end }}{{ end }}", + "inLanguage" : "{{ .Lang }}", + {{ if .Params.author -}} + "author": { + "@type": "Person", + "name": "{{ .Params.author }}" + }, + {{- else if .Site.Author.name -}} + "author": { + "@type": "Person", + "name": "{{ .Site.Author.name }}" + }, + {{- end }} + "copyrightYear" : "{{ .Site.Params.since }} - {{ .Site.LastChange.Format "2006" }}", + {{ if not .PublishDate.IsZero -}} + "datePublished": "{{ .PublishDate.Format "2006-01-02T15:04:05-07:00" | safeHTML }}", + {{- else if not .Date.IsZero -}} + "datePublished": "{{ .Date.Format "2006-01-02T15:04:05-07:00" | safeHTML }}", + {{- end }} + {{ with .Lastmod -}} + "dateModified": "{{ .Format "2006-01-02T15:04:05-07:00" | safeHTML }}", + {{- end }} + "url" : "{{ .Permalink }}", + "wordCount" : "{{ .WordCount }}", + "image" : "{{ .Site.Params.logo | absURL }}", + "keywords" : [ "{{ range $i, $e := .Params.tags }}{{ if $i }}, {{ end }}{{ $e }}{{ end }}" ], + "publisher" : { + "@type": "Organization", + "name" : "{{ .Site.BaseURL }}", + "logo" : { + "@type" : "ImageObject", + "url" : "{{ .Site.Params.logo | absURL }}", + "height" : 60 , + "width" : 60 + } + } +} </script>
\ No newline at end of file diff --git a/layouts/partials/seo/structured/website.html b/layouts/partials/seo/structured/website.html new file mode 100644 index 0000000..3f3b4ff --- /dev/null +++ b/layouts/partials/seo/structured/website.html @@ -0,0 +1,9 @@ +<script type="application/ld+json"> +{ + "@context": "http://schema.org", + "@type": "WebSite", + "name": "{{ .Site.Title }}", + {{- with .Site.Params.alternatePageName }}"alternateName": "{{ . }}",{{- end }} + "url": "{{ .Site.BaseURL }}" +} +</script> diff --git a/layouts/partials/social/main.html b/layouts/partials/social/main.html new file mode 100644 index 0000000..2d26caa --- /dev/null +++ b/layouts/partials/social/main.html @@ -0,0 +1,2 @@ +{{- partial "social/opengraph" . }} +{{- partial "social/twitter" . }} diff --git a/layouts/partials/social/opengraph.html b/layouts/partials/social/opengraph.html new file mode 100644 index 0000000..9a14a07 --- /dev/null +++ b/layouts/partials/social/opengraph.html @@ -0,0 +1,15 @@ +{{- with .Title | default .Site.Title }} +<meta property="og:title" content="{{ . }}" /> +{{- end }} +{{- with .Description | default .Params.subtitle | default .Summary }} +<meta property="og:description" content="{{ . }}"> +{{- end }} +{{- with .Params.share_img | default .Params.image | default .Site.Params.logo }} +<meta property="og:image" content="{{ . | absURL }}" /> +{{- end }} +{{- with .Site.Params.fb_app_id }} +<meta property="fb:app_id" content="{{ . }}" /> +{{- end }} +<meta property="og:url" content="{{ .Permalink | absLangURL }}" /> +<meta property="og:type" content="website" /> +<meta property="og:site_name" content="{{ .Site.Title }}" /> diff --git a/layouts/partials/social/twitter.html b/layouts/partials/social/twitter.html new file mode 100644 index 0000000..0eb1e9b --- /dev/null +++ b/layouts/partials/social/twitter.html @@ -0,0 +1,14 @@ +{{- with .Title | default .Site.Title }} + <meta name="twitter:title" content="{{ . | truncate 70 }}" /> +{{- end }} +{{- with .Description | default .Params.subtitle | default .Summary }} + <meta name="twitter:description" content="{{ . | truncate 200 }}"> +{{- end }} +{{- with .Params.share_img | default .Params.image | default .Site.Params.logo }} + <meta name="twitter:image" content="{{ . | absURL }}" /> +{{- end }} + <meta name="twitter:card" content="summary" /> +{{- with .Site.Author.twitter }} + <meta name="twitter:site" content="@{{ . }}" /> + <meta name="twitter:creator" content="@{{ . }}" /> +{{- end }}
\ No newline at end of file |