Skip to content

Commit

Permalink
Merge pull request #45 from kentnek/kent-disqus-ga
Browse files Browse the repository at this point in the history
  • Loading branch information
jakewies authored Jun 24, 2020
2 parents 4974471 + 793cee0 commit a9a6f0c
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 26 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ A minimal blog theme built for [Hugo](https://gohugo.io/) 🍜
- Blog posts can be tagged 🏷
- Mathematical notations are supported with KaTex 📐
- Sass/SCSS for styling ✨
- Support for Google Analytics 📈 and Disqus 💬

### Prerequisites

Expand Down
6 changes: 6 additions & 0 deletions exampleSite/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ theme = "hugo-theme-codex"
# This is only to get the exampleSite to work in this repo.
themesDir = "../../"

# Add your Disqus shortname here.
# disqusShortname = ""

# Add your Google Analytics identifier: UA-XXXXXXXX-X
# googleAnalytics = ""

# Optional params
[params]
# Follow the Hugo date/time format reference here:
Expand Down
7 changes: 4 additions & 3 deletions layouts/_default/baseof.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
<html lang="{{ .Site.LanguageCode }}">

<head>
<!-- Global site tag (gtag.js) - Google Analytics -->

<title>{{ if .IsHome }}{{ .Site.Title }}{{ else }}{{ .Title }} | {{ .Site.Title }}{{ end }}</title>

<meta charset="UTF-8">
Expand All @@ -13,7 +11,6 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="google-site-verification" content="8cyiY374WL2LGr87fBghcdJCRx6BaPNBvLjeZlk6tyc" />

<!-- Twitter -->
{{ if isset .Site.Params "twitter" }}
Expand Down Expand Up @@ -44,6 +41,10 @@
{{ end }}
{{ block "links" . }} {{ end }}
{{ partial "seo-schema.html" .}}

{{- if not .Site.IsServer -}}
{{ template "_internal/google_analytics_async.html" . }}
{{- end -}}
</head>

<body>
Expand Down
52 changes: 29 additions & 23 deletions layouts/_default/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,34 @@
{{ end }}

{{ define "main" }}
{{ $dateFormat := .Site.Params.dateFormat | default "Jan 2 2006" }}
{{ $dateFormat := .Site.Params.dateFormat | default "Jan 2 2006" }}

<div class="post">
<header class="post__header">
<h1 class="post__title">{{.Title}}</h1>
<time datetime="{{ .Date }}" class="post__date"
>{{ .Date.Format $dateFormat }}</time
>
</header>
<article class="post__content">
{{ partial "anchored-headings.html" .Content }}
{{ if or .Params.math .Site.Params.math }}
{{ partial "math.html" . }}
{{ end }}
</article>
{{ partial "tags.html" .}} {{ partial "post-pagination.html" .}}
</div>
{{ end }} {{ define "footer" }}
<footer>
{{ partial "social-icons.html" .}}
<p>{{ replace .Site.Copyright "{year}" now.Year }}</p>
</footer>
{{ end }} {{ define "scripts" }}
<script src="https://unpkg.com/prismjs@^1.2"></script>
<div class="post">
<header class="post__header">
<h1 class="post__title">{{.Title}}</h1>
<time datetime="{{ .Date }}" class="post__date"
>{{ .Date.Format $dateFormat }}</time>
</header>
<article class="post__content">
{{ partial "anchored-headings.html" .Content }}
{{ if or .Params.math .Site.Params.math }}
{{ partial "math.html" . }}
{{ end }}
</article>
{{ partial "tags.html" .}} {{ partial "post-pagination.html" .}}
</div>

{{ template "_internal/disqus.html" . }}

{{ end }}

{{ define "footer" }}
<footer>
{{ partial "social-icons.html" .}}
<p>{{ replace .Site.Copyright "{year}" now.Year }}</p>
</footer>
{{ end }}

{{ define "scripts" }}
<script src="https://unpkg.com/prismjs@^1.2"></script>
{{ end }}

0 comments on commit a9a6f0c

Please sign in to comment.