refactor the head partials
authorDan Allen <dan@opendevise.com>
Wed, 19 Jun 2019 08:58:46 +0000 (02:58 -0600)
committerDan Allen <dan@opendevise.com>
Thu, 20 Jun 2019 08:50:08 +0000 (02:50 -0600)
- add more fine-grained partials
- introduce defaultPageTitle variable
- stub in favicon

src/layouts/404.hbs
src/layouts/default.hbs
src/partials/head-icons.hbs [new file with mode: 0644]
src/partials/head-info.hbs [new file with mode: 0644]
src/partials/head-meta.hbs
src/partials/head-prelude.hbs [new file with mode: 0644]
src/partials/head-scripts.hbs
src/partials/head-styles.hbs [new file with mode: 0644]
src/partials/head-title.hbs [new file with mode: 0644]
src/partials/head.hbs

index 46bc48e..3974113 100644 (file)
@@ -1,11 +1,7 @@
 <!DOCTYPE html>
 <html lang="en">
   <head>
-    <meta charset="utf-8">
-    <meta name="viewport" content="width=device-width, initial-scale=1.0">
-    <title>{{detag (or page.title 'Page Not Found')}}{{#if site.title}} :: {{site.title}}{{/if}}</title>
-    <link rel="stylesheet" href="{{uiRootPath}}/css/site.css">
-{{> head}}
+{{> head defaultPageTitle="Page Not Found"}}
   </head>
   <body class="status-404">
 {{> header}}
index e7710ca..fc17bf1 100644 (file)
@@ -1,23 +1,7 @@
 <!DOCTYPE html>
 <html lang="en">
   <head>
-    <meta charset="utf-8">
-    <meta name="viewport" content="width=device-width, initial-scale=1.0">
-    <title>{{{detag (or page.title 'Untitled')}}}{{#if site.title}} :: {{site.title}}{{/if}}</title>
-    {{#if page.canonicalUrl}}
-    <link rel="canonical" href="{{page.canonicalUrl}}">
-    {{/if}}
-    {{#if page.description}}
-    <meta name="description" content="{{page.description}}">
-    {{/if}}
-    {{#if page.keywords}}
-    <meta name="keywords" content="{{page.keywords}}">
-    {{/if}}
-    {{#if (or antoraVersion site.antoraVersion)}}
-    <meta name="generator" content="Antora {{or antoraVersion site.antoraVersion}}">
-    {{/if}}
-    <link rel="stylesheet" href="{{uiRootPath}}/css/site.css">
-{{> head}}
+{{> head defaultPageTitle="Untitled"}}
   </head>
   <body class="article">
 {{> header}}
diff --git a/src/partials/head-icons.hbs b/src/partials/head-icons.hbs
new file mode 100644 (file)
index 0000000..aa089d0
--- /dev/null
@@ -0,0 +1 @@
+    {{!-- <link rel="icon" href="{{uiRootPath}}/img/favicon.ico" type="image/x-icon"> --}}
diff --git a/src/partials/head-info.hbs b/src/partials/head-info.hbs
new file mode 100644 (file)
index 0000000..d0a3653
--- /dev/null
@@ -0,0 +1,14 @@
+    {{#if page.canonicalUrl}}
+    <link rel="canonical" href="{{page.canonicalUrl}}">
+    {{/if}}
+    {{#if page.component}}
+    {{#if page.description}}
+    <meta name="description" content="{{page.description}}">
+    {{/if}}
+    {{#if page.keywords}}
+    <meta name="keywords" content="{{page.keywords}}">
+    {{/if}}
+    {{/if}}
+    {{#if (or antoraVersion site.antoraVersion)}}
+    <meta name="generator" content="Antora {{or antoraVersion site.antoraVersion}}">
+    {{/if}}
index 541516c..1aef0af 100644 (file)
@@ -1 +1 @@
-{{! Add additional meta tags here}}
+    {{!-- Add additional meta tags here --}}
diff --git a/src/partials/head-prelude.hbs b/src/partials/head-prelude.hbs
new file mode 100644 (file)
index 0000000..a8b267d
--- /dev/null
@@ -0,0 +1,2 @@
+    <meta charset="utf-8">
+    <meta name="viewport" content="width=device-width,initial-scale=1">
index d113389..882f117 100644 (file)
@@ -1,6 +1,4 @@
-{{#if site.keys.googleAnalytics}}
-{{#with site.keys.googleAnalytics}}
-    <script async src="https://www.googletagmanager.com/gtag/js?id={{this}}"></script>
-    <script>dataLayer=window.dataLayer||[];function gtag(){dataLayer.push(arguments)};gtag('js',new Date());gtag('config','{{this}}')</script>
-{{/with}}
-{{/if}}
+    {{#if site.keys.googleAnalytics}}
+    <script>(window.dataLayer=window.dataLayer||[]).push({'gtm.start':+new Date(),event:'gtm.js'})</script>
+    <script async src="https://www.googletagmanager.com/gtm.js?id={{site.keys.googleAnalytics}}"></script>
+    {{/if}}
diff --git a/src/partials/head-styles.hbs b/src/partials/head-styles.hbs
new file mode 100644 (file)
index 0000000..c1df1ae
--- /dev/null
@@ -0,0 +1 @@
+    <link rel="stylesheet" href="{{uiRootPath}}/css/site.css">
diff --git a/src/partials/head-title.hbs b/src/partials/head-title.hbs
new file mode 100644 (file)
index 0000000..c96c8f2
--- /dev/null
@@ -0,0 +1 @@
+    <title>{{{detag (or page.title defaultPageTitle)}}}{{#if site.title}} :: {{site.title}}{{/if}}</title>
index b4ee621..7dd18b2 100644 (file)
@@ -1,2 +1,7 @@
+{{> head-prelude}}
+{{> head-title}}
+{{> head-info}}
+{{> head-styles}}
 {{> head-meta}}
 {{> head-scripts}}
+{{> head-icons}}