Browse Source

feat(modules): add analytics module

introduces module system and adds example module

BREAKING CHANGE: google analytics no longer supported

closes #1
Josh Habdas 1 year ago
parent
commit
1c5c6bbe1e
Signed by: Josh Habdas <jhabdas@protonmail.com> GPG Key ID: B148B31154C75A74
7 changed files with 88 additions and 4 deletions
  1. 1
    1
      COPYING
  2. 11
    1
      README.md
  3. 4
    1
      bin/install.sh
  4. 5
    0
      docker/docker-compose.dev.yml
  5. 26
    0
      docker/docker-compose.yml
  6. 36
    0
      docker/hugo/Dockerfile
  7. 5
    1
      layouts/_default/baseof.html

+ 1
- 1
COPYING View File

@@ -1,7 +1,7 @@
1 1
             DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
2 2
                     Version 2, December 2004
3 3
 
4
- Copyright (C) 2016—2018 Josh Habdas <jhabdas@protonmail.com>
4
+ Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
5 5
 
6 6
  Everyone is permitted to copy and distribute verbatim or modified
7 7
  copies of this license document, and changing it is allowed as long

+ 11
- 1
README.md View File

@@ -14,6 +14,7 @@
14 14
 
15 15
 Feature | Summary
16 16
 --------|--------
17
+[Module System](#module-system) | Extend After Dark with prebuilt modules to add additional functionality to your site.
17 18
 [Lazy Loading](#lazy-loading) | Lazily load your images, iFrames and script embeds. After Dark ships with [lazysizes](https://github.com/aFarkas/lazysizes), a zero-configuration JavaScript library with LQIP support, responsive images and more.
18 19
 [BPG Image Support](#bpg-image-support) | Improve image fidelity and decrease size. Automatically [BPG Image](https://bellard.org/bpg/) support via polyfill.
19 20
 [Social Engagement](#social-engagement) | After Dark provides automatic and configurable [Open Graph](http://ogp.me/) support, Twitter Cards and Telegram Instant View template to make social shares pop like 37 pieces of flair.
@@ -25,7 +26,6 @@ Feature | Summary
25 26
 [Related Content](#related-content) | Promote more of your content to your site visitors. By offering your readers more content that's relevant to them you can increase your site's page views, the time spent on your site and reader loyalty.
26 27
 [Table of Contents](#table-of-contents) | Help users locate and share information in long posts. By providing a Table of Contents, users will spend less time scrolling to locate information in larger documents and are more likely to deep link to specific information on a page.
27 28
 [Section Menu](#section-menu) | Add and customize your site's global navigation. After Dark uses Hugo's [Section Menu for "the Lazy Blogger"](https://gohugo.io/extras/menus#section-menu-for-the-lazy-blogger), making navigation easy to create and predictable to use.
28
-[Analytics](https://gohugo.io/templates/internal/#google-analytics) | Understand and action on user behavior by enabling Google Analytics. After Dark uses the [async tracking snippet](https://developers.google.com/analytics/devguides/collection/analyticsjs/) to boost performance.
29 29
 [Comments](https://gohugo.io/templates/internal/#disqus) | Improve search rankings and allow users to comment on articles with [Disqus](https://disqus.com/) commenting.
30 30
 [Modification Dating](#modification-dating) | Surface recently updated content to users and crawlers, allowing them to understand when a post or page was was last modified. Recently updated posts will be flagged as modified and visually lifted upwards in chronological listings.
31 31
 [Syntax Highlighting](#syntax-highlighting) | Share code snippets with style. After Dark provides Atom One [Light](https://atom.io/themes/one-light-syntax) and [Dark](https://atom.io/themes/one-dark-syntax) syntax highlighting for 1337 code sharing.
@@ -57,6 +57,14 @@ Installation should complete in a matter of seconds.
57 57
 
58 58
 ## Customizing
59 59
 
60
+### Module System
61
+
62
+After Dark uses Hugo's [Theme Components](https://gohugo.io/themes/theme-components/) functionality to provide add-on modules for the theme. These are entirely optional and are not required for basic functionality. A summary of available modules and links to their repositories can be found in the following table.
63
+
64
+Module Name | Description
65
+------------|--------
66
+[Voyeur](https://git.habd.as/comfusion/voyeur) | Simple, trustworthy website analytics
67
+
60 68
 ### Section Menu
61 69
 
62 70
 After Dark uses Hugo's [Section Menu for Lazy Bloggers](https://gohugo.io/extras/menus/#section-menu-for-the-lazy-blogger) to produce global site navigation if enabled.
@@ -592,4 +600,6 @@ This work is free. You can redistribute it and/or modify it under the
592 600
 terms of the Do What The Fuck You Want To Public License, Version 2,
593 601
 as published by Sam Hocevar. See the COPYING file for more details.
594 602
 
603
+After Dark comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law.
604
+
595 605
 [lazysizes]: https://github.com/aFarkas/lazysizes

+ 4
- 1
bin/install.sh View File

@@ -46,7 +46,10 @@ languageCode = "en-US" # Controls site language
46 46
 title = "After Dark" # Homepage title and page title suffix
47 47
 paginate = 11 # Number of posts to show before paginating
48 48
 
49
-theme = "after-dark" # Set default theme
49
+# Controls default theme and theme components
50
+theme = [
51
+  "after-dark"
52
+]
50 53
 
51 54
 enableRobotsTXT = true # Suggested, enable robots.txt file
52 55
 googleAnalytics = "" # Optional, add tracking Id for analytics

+ 5
- 0
docker/docker-compose.dev.yml View File

@@ -0,0 +1,5 @@
1
+version: "3"
2
+services:
3
+  postgres:
4
+    volumes:
5
+      - ./postgres-data:/var/lib/postgresql/data

+ 26
- 0
docker/docker-compose.yml View File

@@ -0,0 +1,26 @@
1
+version: "3"
2
+services:
3
+  fathom:
4
+    image: usefathom/fathom:latest
5
+    restart: always
6
+    environment:
7
+      - "FATHOM_DATABASE_DRIVER=postgres"
8
+      - "FATHOM_DATABASE_NAME=fathom"
9
+      - "FATHOM_DATABASE_USER=fathom"
10
+      - "FATHOM_DATABASE_PASSWORD=unsafe"
11
+      - "FATHOM_DATABASE_HOST=postgres"
12
+      - "FATHOM_DATABASE_SSLMODE=disable"
13
+    ports:
14
+      - "8080:8080"
15
+    depends_on:
16
+      - postgres
17
+
18
+  postgres:
19
+    image: postgres:latest
20
+    restart: always
21
+    environment:
22
+      - "POSTGRES_USER=fathom"
23
+      - "POSTGRES_PASSWORD=unsafe"
24
+      - "POSTGRES_DB=fathom"
25
+    volumes:
26
+      - /opt/postgres:/var/lib/postgresql/data

+ 36
- 0
docker/hugo/Dockerfile View File

@@ -0,0 +1,36 @@
1
+#
2
+# Hugo Dockerfile for After Dark.
3
+# View the theme at <https://themes.gohugo.io/after-dark/>.
4
+#
5
+# Copyright (C) 2018 Josh Habdas <jhabdas@protonmail.com>
6
+#
7
+# This work is free. You can redistribute it and/or modify it under the
8
+# terms of the Do What The Fuck You Want To Public License, Version 2,
9
+# as published by Sam Hocevar. See the COPYING file for more details.
10
+#
11
+
12
+# DOCKER-VERSION 17.12.0-ce, build c97c6d6
13
+
14
+# Pull hugo builder base image
15
+FROM golang:1.10.3-alpine3.7 AS hugobuilder
16
+
17
+# Set environment variables for hugo build
18
+ENV HUGO_VERSION=0.44 \
19
+    CGO_ENABLED=0 \
20
+    GOOS=linux
21
+
22
+# Build hugo from source using specified version
23
+RUN \
24
+  apk add --update --no-cache git musl-dev && \
25
+  git clone https://github.com/gohugoio/hugo.git $GOPATH/src/github.com/gohugoio/hugo && \
26
+  cd ${GOPATH:-$HOME/go}/src/github.com/gohugoio/hugo && \
27
+  git checkout v$HUGO_VERSION && \
28
+  go get github.com/golang/dep/cmd/dep && \
29
+  dep ensure -vendor-only && \
30
+  go install -ldflags '-s -w'
31
+
32
+# Move compiled binary into own container
33
+FROM scratch
34
+COPY --from=hugobuilder /go/bin/hugo /hugo
35
+ENTRYPOINT ["/hugo"]
36
+CMD ["--help"]

+ 5
- 1
layouts/_default/baseof.html View File

@@ -23,7 +23,11 @@
23 23
       {{ partial "head/site-verification.html" . }}
24 24
     {{ end }}
25 25
     {{ partial "meta/http-referrer.html" . }}
26
-    {{ template "_internal/google_analytics_async.html" . }}
26
+    {{ with .Site.Params.modules }}
27
+      {{ with .voyeur }}
28
+        {{ partial "modules/voyeur/index.html" . }}
29
+      {{ end }}
30
+    {{ end }}
27 31
     {{ if .RSSLink }}
28 32
       <link href="{{ .RSSLink }}" rel="alternate" type="application/rss+xml" title="{{ .Site.Title }}">
29 33
     {{ end }}

Loading…
Cancel
Save