Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/de-souza/hugo-flex.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGreg Anders <greg@gpanders.com>2020-03-05 17:32:15 +0300
committerGreg Anders <greg@gpanders.com>2020-03-05 17:32:15 +0300
commitb1d8f1ac770800352657c80eb9da90ccb7ca2101 (patch)
tree74474590102828758259a44eecc6f2f09cf2687d
parent905522e8747119f415032386800c8d6687762d01 (diff)
Include <head> data in a separate partial
This allows theme users to easily customize what they want to include in the <head> of their documents.
-rw-r--r--layouts/_default/baseof.html15
-rw-r--r--layouts/partials/head.html14
2 files changed, 15 insertions, 14 deletions
diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html
index 8c412ea..c959174 100644
--- a/layouts/_default/baseof.html
+++ b/layouts/_default/baseof.html
@@ -1,20 +1,7 @@
<!DOCTYPE html>
<html lang="{{ site.LanguageCode }}">
<head>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- {{ hugo.Generator }}
- {{ if site.Params.schema }}{{ template "_internal/schema.html" . }}{{ end }}
- {{ if site.Params.opengraph }}{{ template "_internal/opengraph.html" . }}{{ end }}
- {{ if site.Params.twittercards }}{{ template "_internal/twitter_cards.html" . }}{{ end }}
- <title>
- {{ if eq .Title site.Title }}
- {{ site.Title }}
- {{ else }}
- {{ with .Title }}{{ . }} | {{ end }}{{ site.Title }}
- {{ end }}
- </title>
- <link rel="canonical" href="{{ .Permalink }}">
+ {{ partial "head.html" . }}
{{ range .AlternativeOutputFormats }}
{{ printf "<link rel=%q type=%q href=%q title=%q>" .Rel .MediaType .Permalink site.Title | safeHTML }}
{{ end }}
diff --git a/layouts/partials/head.html b/layouts/partials/head.html
new file mode 100644
index 0000000..24b71a7
--- /dev/null
+++ b/layouts/partials/head.html
@@ -0,0 +1,14 @@
+<meta charset="utf-8">
+<meta name="viewport" content="width=device-width, initial-scale=1.0">
+{{ hugo.Generator }}
+{{ if site.Params.schema }}{{ template "_internal/schema.html" . }}{{ end }}
+{{ if site.Params.opengraph }}{{ template "_internal/opengraph.html" . }}{{ end }}
+{{ if site.Params.twittercards }}{{ template "_internal/twitter_cards.html" . }}{{ end }}
+<title>
+ {{ if eq .Title site.Title }}
+ {{ site.Title }}
+ {{ else }}
+ {{ with .Title }}{{ . }} | {{ end }}{{ site.Title }}
+ {{ end }}
+</title>
+<link rel="canonical" href="{{ .Permalink }}">