From 80695973ac0e3dd9a846f055d43fe3969b711144 Mon Sep 17 00:00:00 2001 From: Bjørn Erik Pedersen Date: Tue, 25 Jul 2017 10:18:25 +0200 Subject: Fix disqusShortname conditional Fixes #43 --- layouts/_default/single.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'layouts/_default') diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 96c9f94..2a8e053 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -9,7 +9,7 @@ {{ .Content }} - {{ if and (isset .Site.Params "disqusShortname") (ne .Site.Params.disqusShortname "") }} + {{ if .Site.Params.disqusShortname }}

Comments

{{ partial "disqus" . }} {{ end }} -- cgit 1.4.1 From 5aab5b03ab910f0920b961ebda2f7f75f685b121 Mon Sep 17 00:00:00 2001 From: Vivek Ghaisas Date: Fri, 26 May 2017 23:13:31 +0300 Subject: Fix indentation in layouts - Change indentation to 2 spaces to match convention - Don't indent and as per convention --- layouts/_default/list.html | 12 ++++++------ layouts/_default/single.html | 22 +++++++++++----------- 2 files changed, 17 insertions(+), 17 deletions(-) (limited to 'layouts/_default') diff --git a/layouts/_default/list.html b/layouts/_default/list.html index 7659d47..c362b25 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -1,15 +1,15 @@ {{ partial "head.html" . }} -{{ partial "sidebar.html" . }} + {{ partial "sidebar.html" . }}
diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 2a8e053..26149e7 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -1,13 +1,13 @@ - {{ partial "head.html" . }} - - {{ partial "sidebar.html" . }} +{{ partial "head.html" . }} + + {{ partial "sidebar.html" . }} -
-
-

{{ .Title }}

- - {{ .Content }} -
+
+
+

{{ .Title }}

+ + {{ .Content }} +
{{ if .Site.Params.disqusShortname }}

Comments

@@ -15,5 +15,5 @@ {{ end }}
- - + + \ No newline at end of file -- cgit 1.4.1 From 82832c1244f2d536c754efb98fbdb02b1844f4c7 Mon Sep 17 00:00:00 2001 From: digitalcraftsman Date: Thu, 7 Sep 2017 21:41:16 +0200 Subject: Make use of the base template --- layouts/404.html | 16 ++++------------ layouts/_default/baseof.html | 8 ++++++++ layouts/_default/list.html | 25 +++++++++---------------- layouts/_default/single.html | 29 +++++++++++------------------ layouts/index.html | 33 ++++++++++----------------------- 5 files changed, 42 insertions(+), 69 deletions(-) create mode 100644 layouts/_default/baseof.html (limited to 'layouts/_default') diff --git a/layouts/404.html b/layouts/404.html index 8fa1a59..a919514 100644 --- a/layouts/404.html +++ b/layouts/404.html @@ -1,12 +1,4 @@ -{{ partial "head.html" . }} - - -{{ partial "sidebar.html" . }} - -
-

404: Page not found

-

Sorry, we've misplaced that URL or it's pointing to something that doesn't exist. Head back home to try finding it again.

-
- - - +{{ define "main" -}} +

404: Page not found

+

Sorry, we've misplaced that URL or it's pointing to something that doesn't exist. Head back home to try finding it again.

+{{- end }} \ No newline at end of file diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html new file mode 100644 index 0000000..a45cf37 --- /dev/null +++ b/layouts/_default/baseof.html @@ -0,0 +1,8 @@ +{{ partial "head.html" . }} + + {{ partial "sidebar.html" . }} +
+ {{ block "main" . -}}{{- end }} +
+ + \ No newline at end of file diff --git a/layouts/_default/list.html b/layouts/_default/list.html index c362b25..c6d3b69 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -1,16 +1,9 @@ -{{ partial "head.html" . }} - - - {{ partial "sidebar.html" . }} - -
- -
- - +{{ define "main" -}} + +{{- end }} \ No newline at end of file diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 26149e7..2317495 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -1,19 +1,12 @@ -{{ partial "head.html" . }} - - {{ partial "sidebar.html" . }} +{{ define "main" -}} +
+

{{ .Title }}

+ + {{ .Content }} +
-
-
-

{{ .Title }}

- - {{ .Content }} -
- - {{ if .Site.Params.disqusShortname }} -

Comments

- {{ partial "disqus" . }} - {{ end }} -
- - - \ No newline at end of file +{{ if .Site.Params.disqusShortname -}} +

Comments

+{{ partial "disqus" . }} +{{- end }} +{{- end }} \ No newline at end of file diff --git a/layouts/index.html b/layouts/index.html index 36f3ac2..3fed5be 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -1,26 +1,13 @@ -{{ partial "head.html" . }} - - -{{ partial "sidebar.html" . }} - -
+{{ define "main" -}}
- - {{ range .Data.Pages }} -
-

- - {{ .Title }} - -

- - - - {{ .Content }} -
- {{ end }} +{{ range .Data.Pages -}} +
+

+ {{ .Title }} +

+ + {{ .Content }}
+{{- end }}
- - - +{{- end }} \ No newline at end of file -- cgit 1.4.1 From 8349cf1aa1bf4675ba10bc47882a7fb089a54ceb Mon Sep 17 00:00:00 2001 From: digitalcraftsman Date: Thu, 7 Sep 2017 21:44:44 +0200 Subject: Remove custom Disqus template --- layouts/_default/single.html | 2 +- layouts/partials/disqus.html | 14 -------------- 2 files changed, 1 insertion(+), 15 deletions(-) delete mode 100644 layouts/partials/disqus.html (limited to 'layouts/_default') diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 2317495..c5fdbc2 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -7,6 +7,6 @@ {{ if .Site.Params.disqusShortname -}}

Comments

-{{ partial "disqus" . }} + {{- end }} {{- end }} \ No newline at end of file diff --git a/layouts/partials/disqus.html b/layouts/partials/disqus.html deleted file mode 100644 index 323ae04..0000000 --- a/layouts/partials/disqus.html +++ /dev/null @@ -1,14 +0,0 @@ -
- - -
\ No newline at end of file -- cgit 1.4.1 From eab1974019b3d82cb76cb806ba059fb6cc196111 Mon Sep 17 00:00:00 2001 From: digitalcraftsman Date: Thu, 7 Sep 2017 21:52:10 +0200 Subject: Switch to Hugo's built-in Disqus template --- README.md | 11 +++-------- layouts/_default/single.html | 4 ++-- 2 files changed, 5 insertions(+), 10 deletions(-) (limited to 'layouts/_default') diff --git a/README.md b/README.md index e318520..41f2d5e 100644 --- a/README.md +++ b/README.md @@ -119,19 +119,14 @@ params: ### Disqus -You can optionally enable a comment system powered by Disqus for the posts. Simply add the variable `disqusShortname` to the `params` in your config file. +You can optionally enable a comment system powered by Disqus for the posts. Simply add the variable `disqusShortname` to your config file. **TOML** ```toml -[params] - disqusShortname = "spf13" +disqusShortname = "spf13" ``` -**YAML** -```yaml -params: - disqusShortname: "spf13" -``` +> **Note:** Previous version 1.0 the Disqus shortname had to be defined inside the `[params]` block. ## Author **Mark Otto** diff --git a/layouts/_default/single.html b/layouts/_default/single.html index c5fdbc2..a9f5d33 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -5,8 +5,8 @@ {{ .Content }}
-{{ if .Site.Params.disqusShortname -}} +{{ if .Site.DisqusShortname -}}

Comments

- +{{ template "_internal/disqus.html" . }} {{- end }} {{- end }} \ No newline at end of file -- cgit 1.4.1 From 7cf2943ef4a905b46f77137a0321a4fc996a3b9e Mon Sep 17 00:00:00 2001 From: digitalcraftsman Date: Thu, 7 Sep 2017 21:56:31 +0200 Subject: Add Google Analytics support Closes #44 --- README.md | 18 +++++++++++++++++- layouts/_default/baseof.html | 2 ++ 2 files changed, 19 insertions(+), 1 deletion(-) (limited to 'layouts/_default') diff --git a/README.md b/README.md index 41f2d5e..82660cb 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,7 @@ It pairs a prominent sidebar with uncomplicated content. - [Themes](#themes) - [Reverse layout](#reverse-layout) - [Disqus](#disqus) + - [Google Analytics](#google-analytics) - [Author](#author) - [Ported by](#ported-by) - [License](#license) @@ -119,7 +120,7 @@ params: ### Disqus -You can optionally enable a comment system powered by Disqus for the posts. Simply add the variable `disqusShortname` to your config file. +You can optionally enable a comment system powered by Disqus for the posts. Simply add the variable `disqusShortname` to your config file. **TOML** ```toml @@ -128,6 +129,21 @@ disqusShortname = "spf13" > **Note:** Previous version 1.0 the Disqus shortname had to be defined inside the `[params]` block. + +## Google Analytics + +Google Analytics can be enabled by assigning your tracking code to the `googleAnalytics` variable in the config file: + +**TOML** +```toml +googleAnalytics = "Your tracking code" +``` + +**YAML** +```yaml +googleAnalytics: Your tracking code +``` + ## Author **Mark Otto** - diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index a45cf37..0c87c3f 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -4,5 +4,7 @@
{{ block "main" . -}}{{- end }}
+ + {{ template "_internal/google_analytics_async.html" . }} \ No newline at end of file -- cgit 1.4.1