Browse Source

feat(modules): add analytics module

introduces module system and adds example module

BREAKING CHANGE: google analytics no longer supported

closes #1
pull/149/head
Josh Habdas 2 years ago
parent
commit
1c5c6bbe1e
Signed by: jhabdas 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 @@
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2016—2018 Josh Habdas <jhabdas@protonmail.com>
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long

+ 11
- 1
README.md View File

@ -14,6 +14,7 @@
Feature | Summary
--------|--------
[Module System](#module-system) | Extend After Dark with prebuilt modules to add additional functionality to your site.
[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.
[BPG Image Support](#bpg-image-support) | Improve image fidelity and decrease size. Automatically [BPG Image](https://bellard.org/bpg/) support via polyfill.
[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
[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.
[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.
[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.
[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.
[Comments](https://gohugo.io/templates/internal/#disqus) | Improve search rankings and allow users to comment on articles with [Disqus](https://disqus.com/) commenting.
[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.
[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.
## Customizing
### Module System
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.
Module Name | Description
------------|--------
[Voyeur](https://git.habd.as/comfusion/voyeur) | Simple, trustworthy website analytics
### Section Menu
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
terms of the Do What The Fuck You Want To Public License, Version 2,
as published by Sam Hocevar. See the COPYING file for more details.
After Dark comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law.
[lazysizes]: https://github.com/aFarkas/lazysizes

+ 4
- 1
bin/install.sh View File

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

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

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

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

@ -0,0 +1,26 @@
version: "3"
services:
fathom:
image: usefathom/fathom:latest
restart: always
environment:
- "FATHOM_DATABASE_DRIVER=postgres"
- "FATHOM_DATABASE_NAME=fathom"
- "FATHOM_DATABASE_USER=fathom"
- "FATHOM_DATABASE_PASSWORD=unsafe"
- "FATHOM_DATABASE_HOST=postgres"
- "FATHOM_DATABASE_SSLMODE=disable"
ports:
- "8080:8080"
depends_on:
- postgres
postgres:
image: postgres:latest
restart: always
environment:
- "POSTGRES_USER=fathom"
- "POSTGRES_PASSWORD=unsafe"
- "POSTGRES_DB=fathom"
volumes:
- /opt/postgres:/var/lib/postgresql/data

+ 36
- 0
docker/hugo/Dockerfile View File

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

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

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

Loading…
Cancel
Save