bridgetown-plausible 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: f54817eaa2b2ad905d097e39de9d9b5873ea1e4d5e50d062ad56e2fd2ce45453
4
+ data.tar.gz: 83e01a576a483bb8b301bd09eda48b6812d6be6a389987b70ce36813b06c5db1
5
+ SHA512:
6
+ metadata.gz: d11cf27fe5ce1cb4a1b8109bed8c3397093c14eba0712b23621fbbe44e38ac37918eb57a1167ebf90cf0e80038d927339991789e791ad94fe3572bb63e0b284d
7
+ data.tar.gz: 1a80df0ff019b264cb43b0532477e96ed42e35e0e17a9f888950a88615d053f0a6b18b3b73c610b3fb3504a62bc841964d97852da338c5995ee5c3fd7a4db8ce
@@ -0,0 +1 @@
1
+ . @andrewmcodes
@@ -0,0 +1,87 @@
1
+ # Contributing Guide
2
+
3
+ Thanks for being willing to contribute!
4
+
5
+ - [Contributing Guide](#contributing-guide)
6
+ - [Commit Message Convention](#commit-message-convention)
7
+ - [Project setup](#project-setup)
8
+ - [Tests](#tests)
9
+ - [Style](#style)
10
+ - [Run Demo](#run-demo)
11
+ - [Help needed](#help-needed)
12
+
13
+ ## Commit Message Convention
14
+
15
+ Commits should follow the [Conventional Commits spec](https://conventionalcommits.org/).
16
+
17
+ ## Project setup
18
+
19
+ 1. Fork and clone the repo
20
+ 2. `bundle install` to install dependencies
21
+ 3. Create a branch for your PR
22
+
23
+ > Tip: Keep your `main` branch pointing at the original repository and make
24
+ > pull requests from branches on your fork. To do this, run:
25
+ >
26
+ > ```
27
+ > git remote add upstream https://github.com/bt-rb/this-project
28
+ > git fetch upstream
29
+ > git branch --set-upstream-to=upstream/main main
30
+ > ```
31
+ >
32
+ > This will add the original repository as a "remote" called "upstream," Then
33
+ > fetch the git information from that remote, then set your local `main`
34
+ > branch to use the upstream main branch whenever you run `git pull`. Then you
35
+ > can make all of your pull request branches based on this `main` branch.
36
+ > Whenever you want to update your version of `main`, do a regular `git pull`.
37
+
38
+ ## Tests
39
+
40
+ Run the tests:
41
+
42
+ ```sh
43
+ rake
44
+ ```
45
+
46
+ ## Style
47
+
48
+ Run the linter:
49
+
50
+ ```sh
51
+ bin/lint
52
+ ```
53
+
54
+ Run the formatter:
55
+
56
+ ```sh
57
+ bin/format
58
+ ```
59
+
60
+ ## Run Demo
61
+
62
+ ```sh
63
+ cd demo
64
+ bundle
65
+ bundle exec bridgetown serve
66
+ ```
67
+
68
+ Open up [localhost:4000](http://localhost:4000) in your browser.
69
+
70
+ ## Release
71
+
72
+ Releases are handled automatically via GitHub Actions.
73
+
74
+ Release locally:
75
+
76
+ ```sh
77
+ rake release
78
+ ```
79
+
80
+ ## Help needed
81
+
82
+ Please checkout the the open issues.
83
+
84
+ Also, please watch the repo and respond to questions/bug reports/feature
85
+ requests!
86
+
87
+ Thanks!
@@ -0,0 +1,12 @@
1
+ # These are supported funding model platforms
2
+
3
+ github: andrewmcodes
4
+ # patreon: # Replace with a single Patreon username
5
+ # open_collective: # Replace with a single Open Collective username
6
+ # ko_fi: # Replace with a single Ko-fi username
7
+ # tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8
+ # community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9
+ # liberapay: # Replace with a single Liberapay username
10
+ # issuehunt: # Replace with a single IssueHunt username
11
+ # otechie: # Replace with a single Otechie username
12
+ # custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
@@ -0,0 +1,4 @@
1
+ <svg height="64" viewbox="0 0 64 64" width="64" xmlns="http://www.w3.org/2000/svg">
2
+ <g class="nc-icon-wrapper" fill="#2b57fe"><path d="M61,53c-0.6,0-1,0.4-1,1c0,3.9-3.1,7-7,7c-2.5,0-4.9-1.4-6.1-3.7c-0.3-0.6-1.4-0.6-1.8,0 C43.9,59.6,41.5,61,39,61s-4.9-1.4-6.1-3.7c-0.3-0.6-1.4-0.6-1.8,0C29.9,59.6,27.5,61,25,61s-4.9-1.4-6.1-3.7 c-0.3-0.6-1.4-0.6-1.8,0C15.9,59.6,13.5,61,11,61c-3.9,0-7-3.1-7-7c0-0.6-0.4-1-1-1c-0.6,0-1,0.4-1,1c0,5,4,9,9,9 c2.7,0,5.3-1.3,7-3.4c1.7,2.1,4.3,3.4,7,3.4c2.7,0,5.3-1.3,7-3.4c1.7,2.1,4.3,3.4,7,3.4c2.7,0,5.3-1.3,7-3.4c1.7,2.1,4.3,3.4,7,3.4 c5,0,9-4,9-9C62,53.4,61.6,53,61,53z" data-color="color-2"/>
3
+ <path d="M62,1h-8c-0.6,0-1,0.4-1,1v2c0,11.6-9.4,21-21,21c-11.6,0-21-9.4-21-21V2c0-0.6-0.4-1-1-1H2C1.4,1,1,1.4,1,2 v44c0,0.6,0.4,1,1,1h8c0.6,0,1-0.4,1-1v-3h42v3c0,0.6,0.4,1,1,1h8c0.6,0,1-0.4,1-1V2C63,1.4,62.6,1,62,1z M31,41h-8V25.2 c2.5,1.1,5.2,1.7,8,1.8V41z M33,27c2.8-0.1,5.5-0.8,8-1.8V41h-8V27z M11,13.4c2.1,4.6,5.6,8.4,10,10.8V41H11V13.4z M43,41V24.2 c4.4-2.4,7.9-6.2,10-10.8V41H43z" fill="#2b57fe"/></g>
4
+ </svg>
@@ -0,0 +1,25 @@
1
+ name: Lint
2
+
3
+ on:
4
+ pull_request:
5
+ branches:
6
+ - "*"
7
+ push:
8
+ branches:
9
+ - main
10
+
11
+ jobs:
12
+ lint:
13
+ runs-on: ubuntu-latest
14
+ if: "!contains(github.event.head_commit.message, 'ci skip')"
15
+ steps:
16
+ - uses: actions/checkout@v2
17
+ - name: Set up Ruby
18
+ uses: ruby/setup-ruby@v1
19
+ with:
20
+ ruby-version: 3.0.0
21
+ - name: Run bin/lint
22
+ run: |
23
+ gem install bundler -v 2.2.7
24
+ bundle install
25
+ bin/lint
@@ -0,0 +1,40 @@
1
+ name: Release
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ jobs:
8
+ release-please:
9
+ runs-on: ubuntu-latest
10
+ steps:
11
+ - uses: GoogleCloudPlatform/release-please-action@v2
12
+ id: release
13
+ with:
14
+ token: ${{ secrets.GITHUB_TOKEN }}
15
+ release-type: ruby
16
+ package-name: gem-release-demo
17
+ bump-minor-pre-major: true
18
+ version-file: "lib/bridgetown-plausible/version.rb"
19
+ - uses: actions/checkout@v2
20
+ if: ${{ steps.release.outputs.release_created }}
21
+ - uses: ruby/setup-ruby@v1
22
+ with:
23
+ ruby-version: 3.0.0
24
+ if: ${{ steps.release.outputs.release_created }}
25
+ - run: |
26
+ gem install bundler -v 2.2.7
27
+ bundle install
28
+ bundle exec rake
29
+ if: ${{ steps.release.outputs.release_created }}
30
+ - name: release gem
31
+ run: |
32
+ mkdir -p $HOME/.gem
33
+ touch $HOME/.gem/credentials
34
+ chmod 0600 $HOME/.gem/credentials
35
+ printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
36
+ gem build *.gemspec
37
+ gem push *.gem
38
+ env:
39
+ GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"
40
+ if: ${{ steps.release.outputs.release_created }}
@@ -0,0 +1,27 @@
1
+ name: Test
2
+
3
+ on:
4
+ pull_request:
5
+ branches:
6
+ - "*"
7
+ push:
8
+ branches:
9
+ - main
10
+
11
+ jobs:
12
+ lint:
13
+ runs-on: ubuntu-latest
14
+ if: "!contains(github.event.head_commit.message, 'ci skip')"
15
+ steps:
16
+ - uses: actions/checkout@v2
17
+ - name: Set up Ruby
18
+ uses: ruby/setup-ruby@v1
19
+ with:
20
+ ruby-version: 3.0.0
21
+ - name: Run specs
22
+ run: |
23
+ gem install bundler -v 2.2.7
24
+ bundle install
25
+ rake
26
+ env:
27
+ COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
data/.gitignore ADDED
@@ -0,0 +1,39 @@
1
+ /vendor
2
+ /.bundle/
3
+ /.yardoc
4
+ /Gemfile.lock
5
+ /_yardoc/
6
+ /coverage/
7
+ /doc/
8
+ /pkg/
9
+ /spec/reports/
10
+ /tmp/
11
+ *.bundle
12
+ *.so
13
+ *.o
14
+ *.a
15
+ mkmf.log
16
+ *.gem
17
+ Gemfile.lock
18
+ .bundle
19
+ .ruby-version
20
+
21
+ # Node
22
+ node_modules
23
+ .npm
24
+ .node_repl_history
25
+
26
+ # Yarn
27
+ yarn-error.log
28
+ yarn-debug.log*
29
+ .pnp/
30
+ .pnp.js
31
+
32
+ # Yarn Integrity file
33
+ .yarn-integrity
34
+
35
+ spec/dest
36
+ .bridgetown-metadata
37
+ .bridgetown-cache
38
+ .bridgetown-webpack
39
+ output
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/CHANGELOG.md ADDED
@@ -0,0 +1,9 @@
1
+ # Changelog
2
+
3
+ ## 1.0.0 (2021-02-06)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * correct logo url ([#1](https://www.github.com/bt-rb/bridgetown-plausible/issues/1)) ([22db435](https://www.github.com/bt-rb/bridgetown-plausible/commit/22db43569e90375c1895f20c232607a93f9bf023))
9
+ * correct test action name ([1d0526a](https://www.github.com/bt-rb/bridgetown-plausible/commit/1d0526a7eb1fe608dfba174b11b76490870d6dc2))
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+ gemspec
5
+
6
+ gem "bridgetown", ENV["BRIDGETOWN_VERSION"] if ENV["BRIDGETOWN_VERSION"]
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2020-present Andrew Mason
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,109 @@
1
+ <p align="center">
2
+ <a href="https://github.com/bt-rb" target="_blank" rel="noopener noreferrer">
3
+ <img src="https://github.com/bt-rb/bridgetown-plausible/blob/main/.github/media/logo.svg" width="100px">
4
+ </a>
5
+ </p>
6
+
7
+ <p align="center">
8
+ <a href="https://badge.fury.io/rb/bridgetown-plausible"><img src="https://badge.fury.io/rb/bridgetown-plausible.svg" alt="Gem Version" height="18"></a>
9
+ <img src="https://img.shields.io/github/license/bt-rb/.github">
10
+ <img src="https://github.com/bt-rb/bridgetown-plausible/workflows/Test/badge.svg" alt="test">
11
+ <img src="https://github.com/bt-rb/bridgetown-plausible/workflows/Lint/badge.svg" alt="lint">
12
+ <img src="https://github.com/bt-rb/bridgetown-plausible/workflows/Release/badge.svg" alt="release">
13
+ </p>
14
+
15
+ <h2 align="center">bridgetown-plausible</h2>
16
+
17
+ [Plausible](https://plausible.io) is a lightweight and open-source website analytics tool. It doesn’t use cookies and is fully compliant with GDPR, CCPA and PECR. This plugin is meant to remove all friction from adding your [Plausible Analytics tracking script code](https://docs.plausible.io/plausible-script) to your Bridgetown site.
18
+
19
+ ## Table of contents
20
+
21
+ - [Table of contents](#table-of-contents)
22
+ - [Quickstart](#quickstart)
23
+ - [System requirements](#system-requirements)
24
+ - [Installation](#installation)
25
+ - [Configuration](#configuration)
26
+ - [Usage](#usage)
27
+ - [Liquid](#liquid)
28
+ - [ERB](#erb)
29
+ - [Changelog](#changelog)
30
+ - [Contribution](#contribution)
31
+ - [License](#license)
32
+
33
+ ## Quickstart
34
+
35
+ Use the automation to add to your site:
36
+
37
+ ```sh
38
+ bundle exec bridgetown apply https://github.com/btrb/bridgetown-plausible
39
+ ```
40
+
41
+ ## System requirements
42
+
43
+ - Ruby >= `2.5`
44
+ - Bundler
45
+ - Bridgetown >= `0.16`
46
+
47
+ ## Installation
48
+
49
+ Automatically add to `Gemfile`:
50
+
51
+ ```bash
52
+ bundle add bridgetown-plausible -g bridgetown_plugins
53
+ ```
54
+
55
+ or add manually in `Gemfile`:
56
+
57
+ ```ruby
58
+ group :bridgetown_plugins do
59
+ gem "bridgetown-plausible", "~> 0.1.0"
60
+ end
61
+ ```
62
+
63
+ Run `bundle install` and then modify your `bridgetown.config.yml` configuration to point to your Plausible domain.
64
+
65
+ ## Configuration
66
+
67
+ ```yml
68
+ # bridgetown.config.yml
69
+
70
+ plausible:
71
+ # Your Plausible domain.
72
+ # Note that this domain should not include www or https://
73
+ #
74
+ # Type: String
75
+ # Required: true
76
+ domain: example.com
77
+ ```
78
+
79
+ ## Usage
80
+
81
+ This plugin provides the `plausible` Liquid tag & ERB helper to your site. If `BRIDGETOWN_ENV` is not `production`, than the tag will be wrapped in an HTML comment to prevent console erros in development. Make sure you set `BRIDGETOWN_ENV="production"` when you deploy in your script or in Netlify/Vercel/etc.
82
+
83
+ Use the tag in the head of your document:
84
+
85
+ ### Liquid
86
+
87
+ ```liquid
88
+ {% plausible %}
89
+ ```
90
+
91
+ ### ERB
92
+
93
+ ```erb
94
+ <%= plausible %>
95
+ ```
96
+
97
+ ## Changelog
98
+
99
+ Detailed changes for each release are documented in the [release notes](https://github.com/bt-rb/bridgetown-plausible/releases).
100
+
101
+ ## Contribution
102
+
103
+ Please make sure to read the [Contributing Guide](.github/CONTRIBUTING.md) before making a pull request.
104
+
105
+ ## License
106
+
107
+ [MIT](https://opensource.org/licenses/MIT)
108
+
109
+ Copyright (c) 2021-present, Andrew Mason
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ task :default => :spec
data/bin/format ADDED
@@ -0,0 +1,5 @@
1
+ #!/bin/bash
2
+ set -e
3
+
4
+ echo "== Checking StandardRb =="
5
+ bundle exec standardrb --format=progress
data/bin/lint ADDED
@@ -0,0 +1,5 @@
1
+ #!/bin/bash
2
+ set -e
3
+
4
+ echo "== StandardRb =="
5
+ bundle exec standardrb --fix --format=progress
data/bin/rspec ADDED
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'rspec' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "pathname"
12
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ bundle_binstub = File.expand_path("../bundle", __FILE__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
26
+ require "rubygems"
27
+ require "bundler/setup"
28
+
29
+ load Gem.bin_path("rspec-core", "rspec")
data/bin/standardrb ADDED
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'standardrb' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "pathname"
12
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ bundle_binstub = File.expand_path("../bundle", __FILE__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
26
+ require "rubygems"
27
+ require "bundler/setup"
28
+
29
+ load Gem.bin_path("standard", "standardrb")
data/bin/test ADDED
@@ -0,0 +1,4 @@
1
+ #!/bin/bash
2
+ set -ex
3
+
4
+ bin/rspec "$@"
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/bridgetown-plausible/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "bridgetown-plausible"
7
+ spec.version = Bridgetown::Plausible::VERSION
8
+ spec.authors = ["Andrew Mason"]
9
+ spec.email = ["andrewmcodes@protonmail.com"]
10
+ spec.summary = "Plausible Analytics Plugin for Bridgetown"
11
+ spec.description = "A Liquid tag to add Plausible analytics to your site."
12
+ spec.homepage = "https://github.com/btrb/#{spec.name}"
13
+ spec.license = "MIT"
14
+ spec.metadata = {
15
+ "bug_tracker_uri" => "#{spec.homepage}/issues",
16
+ "changelog_uri" => "#{spec.homepage}/blob/main/CHANGELOG.md",
17
+ "documentation_uri" => spec.homepage.to_s,
18
+ "homepage_uri" => spec.homepage.to_s,
19
+ "source_code_uri" => spec.homepage.to_s
20
+ }
21
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|script|spec|features|frontend)/}) }
22
+ spec.test_files = spec.files.grep(%r{^spec/})
23
+ spec.require_paths = ["lib"]
24
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.5.0")
25
+
26
+ spec.add_dependency "bridgetown", ">= 0.16", "< 2.0"
27
+
28
+ spec.add_development_dependency "bundler"
29
+ spec.add_development_dependency "nokogiri", "~> 1.6"
30
+ spec.add_development_dependency "rake", "~> 13.0"
31
+ spec.add_development_dependency "rspec", "~> 3.0"
32
+ spec.add_development_dependency "standard", "~> 0.12"
33
+ end
@@ -0,0 +1,16 @@
1
+ say_status :plausible, "Installing the bridgetown-plausible-tag plugin..."
2
+
3
+ domain_name = ask("What's your Plausible domain?")
4
+
5
+ add_bridgetown_plugin "bridgetown-plausible-tag"
6
+
7
+ append_to_file "bridgetown.config.yml" do
8
+ <<~YAML
9
+
10
+ plausible:
11
+ domain: #{domain_name}
12
+ YAML
13
+ end
14
+
15
+ say_status :plausible, "All set! Double-check the plausible block in your config file and review docs at"
16
+ say_status :plausible, "https://github.com/andrewmcodes/bridgetown-plausible-tag"
data/demo/Gemfile ADDED
@@ -0,0 +1,22 @@
1
+ source "https://rubygems.org"
2
+ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
3
+
4
+ # Hello! This is where you manage which Bridgetown version is used to run.
5
+ # When you want to use a different version, change it below, save the
6
+ # file and run `bundle install`. Run Bridgetown with `bundle exec`, like so:
7
+ #
8
+ # bundle exec bridgetown serve
9
+ #
10
+ # This will help ensure the proper Bridgetown version is running.
11
+ #
12
+ # To install a plugin, simply run bundle add and specify the group
13
+ # "bridgetown_plugins". For example:
14
+ #
15
+ # bundle add some-new-plugin -g bridgetown_plugins
16
+ #
17
+ # Happy Bridgetowning!
18
+
19
+ gem "bridgetown", "~> 0.19.2"
20
+ group :bridgetown_plugins do
21
+ gem "bridgetown-plausible", path: "../"
22
+ end
@@ -0,0 +1,30 @@
1
+ # Welcome to Bridgetown!
2
+ #
3
+ # This config file is for settings that affect your whole site, values
4
+ # which you are expected to set up once and rarely edit after that.
5
+ #
6
+ # For technical reasons, this file is *NOT* reloaded automatically when you use
7
+ # 'bundle exec bridgetown serve'. If you change this file, please restart the
8
+ # server process.
9
+ #
10
+ # For reloadable site metadata like title, SEO description, social media
11
+ # handles, etc., take a look at src/_data/site_metadata.yml
12
+ #
13
+ # If you need help with YAML syntax, here are some quick references for you:
14
+ # https://learn-the-web.algonquindesign.ca/topics/markdown-yaml-cheat-sheet/#yaml
15
+ # https://learnxinyminutes.com/docs/yaml/
16
+ #
17
+
18
+ baseurl: "" # OPTIONAL: the subpath of your site, e.g. /blog
19
+ url: "" # the base hostname & protocol for your site, e.g. https://example.com
20
+
21
+ permalink: pretty
22
+
23
+ # timezone: America/Los_Angeles
24
+ plausible:
25
+ # Your Plausible domain.
26
+ # Note that this domain should not include www or https://
27
+ #
28
+ # Type: String
29
+ # Required: true
30
+ domain: example.com
File without changes
@@ -0,0 +1,4 @@
1
+ class SiteBuilder < Bridgetown::Builder
2
+ # write builders which subclass SiteBuilder in plugins/builder
3
+ end
4
+
data/demo/src/404.html ADDED
@@ -0,0 +1,9 @@
1
+ ---
2
+ permalink: /404.html
3
+ layout: default
4
+ ---
5
+
6
+ <h1>404</h1>
7
+
8
+ <p><strong>Page not found :(</strong></p>
9
+ <p>The requested page could not be found.</p>
@@ -0,0 +1,11 @@
1
+ # Site settings
2
+ # These are used to personalize your new site. If you look in the HTML files,
3
+ # you will see them accessed via {{ site.metadata.title }}, {{ site.metadata.email }}, and so on.
4
+ # You can create any custom variable you would like, and they will be accessible
5
+ # in the templates via {{ site.metadata.myvariable }}.
6
+
7
+ title: Your awesome title
8
+ tagline: This site is totally awesome
9
+ email: your-email@example.com
10
+ description: >- # this means to ignore newlines until "baseurl:"
11
+ Write an awesome description for your new site here. It will appear in your document head meta (for Google search results) and in your feed.xml site description.
@@ -0,0 +1,26 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <title>{{ metadata.title }}</title>
7
+ <meta name="description" content="{{ metadata.description }}" />
8
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/mini.css/3.0.1/mini-default.min.css">
9
+ </head>
10
+ <body class="{{ page.layout }} {{ page.page_class }}">
11
+ <header>
12
+ <a href="/" class="button">Home</a>
13
+ <a href="/liquid" class="button">Liquid</a>
14
+ <a href="/erb" class="button">ERB</a>
15
+ </header>
16
+ <main>
17
+ <section class="row">
18
+ <div class="col-sm-12">
19
+ <article class="card fluid">
20
+ {{ content }}
21
+ </article>
22
+ </div>
23
+ </section>
24
+ </main>
25
+ </body>
26
+ </html>
data/demo/src/erb.erb ADDED
@@ -0,0 +1,17 @@
1
+ ---
2
+ layout: default
3
+ permalink: /erb/
4
+ ---
5
+
6
+ <%= markdownify do %>
7
+ # ERB
8
+
9
+ ```erb
10
+ <%%= plausible %>
11
+ ```
12
+
13
+ Output:
14
+ ```
15
+ <%= plausible %>
16
+ ```
17
+ <% end %>
File without changes
data/demo/src/index.md ADDED
@@ -0,0 +1,6 @@
1
+ ---
2
+ layout: default
3
+ ---
4
+
5
+ - [ERB layout](/erb/)
6
+ - [Liquid layout](/liquid/)
@@ -0,0 +1,18 @@
1
+ ---
2
+ layout: default
3
+ permalink: /liquid/
4
+ ---
5
+
6
+ # Liquid
7
+
8
+
9
+ {% raw %}
10
+ ```liquid
11
+ {% plausible %}
12
+ ```
13
+ {% endraw %}
14
+
15
+ Output:
16
+ ```
17
+ {% plausible %}
18
+ ```
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bridgetown"
4
+ require "bridgetown-plausible/builder"
@@ -0,0 +1,48 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bridgetown
4
+ module Plausible
5
+ class Builder < Bridgetown::Builder
6
+ def build
7
+ liquid_tag "plausible" do |_attributes, tag|
8
+ render
9
+ end
10
+
11
+ helper "plausible" do
12
+ render
13
+ end
14
+ end
15
+
16
+ private
17
+
18
+ def render
19
+ domain = options.dig(:domain)&.strip
20
+
21
+ tag = if domain
22
+ markup_for_domain(domain)
23
+ else
24
+ Bridgetown.logger.warn "Plausible", "Domain not configured."
25
+ markup_for_domain("NOT CONFIGURED")
26
+ end
27
+
28
+ return wrap_with_comment(tag) unless Bridgetown.environment.production?
29
+
30
+ tag
31
+ end
32
+
33
+ def markup_for_domain(domain)
34
+ "<script async defer data-domain=\"#{domain}\" src=\"https://plausible.io/js/plausible.js\"></script>"
35
+ end
36
+
37
+ def wrap_with_comment(tag)
38
+ "<!-- #{tag} -->"
39
+ end
40
+
41
+ def options
42
+ config["plausible"] || {}
43
+ end
44
+ end
45
+ end
46
+ end
47
+
48
+ Bridgetown::Plausible::Builder.register
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bridgetown
4
+ module Plausible
5
+ VERSION = "1.0.0"
6
+ end
7
+ end
metadata ADDED
@@ -0,0 +1,173 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bridgetown-plausible
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Andrew Mason
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2021-02-06 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bridgetown
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0.16'
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '2.0'
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: '0.16'
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '2.0'
33
+ - !ruby/object:Gem::Dependency
34
+ name: bundler
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ type: :development
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ - !ruby/object:Gem::Dependency
48
+ name: nokogiri
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: '1.6'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - "~>"
59
+ - !ruby/object:Gem::Version
60
+ version: '1.6'
61
+ - !ruby/object:Gem::Dependency
62
+ name: rake
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - "~>"
66
+ - !ruby/object:Gem::Version
67
+ version: '13.0'
68
+ type: :development
69
+ prerelease: false
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - "~>"
73
+ - !ruby/object:Gem::Version
74
+ version: '13.0'
75
+ - !ruby/object:Gem::Dependency
76
+ name: rspec
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - "~>"
80
+ - !ruby/object:Gem::Version
81
+ version: '3.0'
82
+ type: :development
83
+ prerelease: false
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - "~>"
87
+ - !ruby/object:Gem::Version
88
+ version: '3.0'
89
+ - !ruby/object:Gem::Dependency
90
+ name: standard
91
+ requirement: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - "~>"
94
+ - !ruby/object:Gem::Version
95
+ version: '0.12'
96
+ type: :development
97
+ prerelease: false
98
+ version_requirements: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - "~>"
101
+ - !ruby/object:Gem::Version
102
+ version: '0.12'
103
+ description: A Liquid tag to add Plausible analytics to your site.
104
+ email:
105
+ - andrewmcodes@protonmail.com
106
+ executables: []
107
+ extensions: []
108
+ extra_rdoc_files: []
109
+ files:
110
+ - ".github/CODEOWNERS"
111
+ - ".github/CONTRIBUTING.md"
112
+ - ".github/FUNDING.yml"
113
+ - ".github/media/logo.svg"
114
+ - ".github/workflows/lint.yml"
115
+ - ".github/workflows/release.yml"
116
+ - ".github/workflows/test.yml"
117
+ - ".gitignore"
118
+ - ".rspec"
119
+ - CHANGELOG.md
120
+ - Gemfile
121
+ - LICENSE.txt
122
+ - README.md
123
+ - Rakefile
124
+ - bin/format
125
+ - bin/lint
126
+ - bin/rspec
127
+ - bin/standardrb
128
+ - bin/test
129
+ - bridgetown-plausible.gemspec
130
+ - bridgetown.automation.rb
131
+ - demo/Gemfile
132
+ - demo/bridgetown.config.yml
133
+ - demo/plugins/builders/.keep
134
+ - demo/plugins/site_builder.rb
135
+ - demo/src/404.html
136
+ - demo/src/_data/site_metadata.yml
137
+ - demo/src/_layouts/default.liquid
138
+ - demo/src/erb.erb
139
+ - demo/src/favicon.ico
140
+ - demo/src/index.md
141
+ - demo/src/liquid.md
142
+ - lib/bridgetown-plausible.rb
143
+ - lib/bridgetown-plausible/builder.rb
144
+ - lib/bridgetown-plausible/version.rb
145
+ homepage: https://github.com/btrb/bridgetown-plausible
146
+ licenses:
147
+ - MIT
148
+ metadata:
149
+ bug_tracker_uri: https://github.com/btrb/bridgetown-plausible/issues
150
+ changelog_uri: https://github.com/btrb/bridgetown-plausible/blob/main/CHANGELOG.md
151
+ documentation_uri: https://github.com/btrb/bridgetown-plausible
152
+ homepage_uri: https://github.com/btrb/bridgetown-plausible
153
+ source_code_uri: https://github.com/btrb/bridgetown-plausible
154
+ post_install_message:
155
+ rdoc_options: []
156
+ require_paths:
157
+ - lib
158
+ required_ruby_version: !ruby/object:Gem::Requirement
159
+ requirements:
160
+ - - ">="
161
+ - !ruby/object:Gem::Version
162
+ version: 2.5.0
163
+ required_rubygems_version: !ruby/object:Gem::Requirement
164
+ requirements:
165
+ - - ">="
166
+ - !ruby/object:Gem::Version
167
+ version: '0'
168
+ requirements: []
169
+ rubygems_version: 3.2.3
170
+ signing_key:
171
+ specification_version: 4
172
+ summary: Plausible Analytics Plugin for Bridgetown
173
+ test_files: []