bridgetown-plausible 1.0.2 → 2.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 +4 -4
- data/.github/workflows/lint.yml +4 -6
- data/.github/workflows/release.yml +13 -16
- data/.github/workflows/test.yml +21 -9
- data/.release-please-manifest.json +3 -0
- data/CHANGELOG.md +29 -0
- data/LICENSE.txt +1 -1
- data/README.md +44 -9
- data/Rakefile +1 -1
- data/bridgetown-plausible.gemspec +7 -7
- data/bridgetown.automation.rb +29 -8
- data/demo/Gemfile +1 -1
- data/demo/bridgetown.config.yml +9 -1
- data/demo/config/initializers.rb +5 -0
- data/demo/plugins/site_builder.rb +0 -1
- data/demo/src/_layouts/default.liquid +1 -0
- data/lib/bridgetown-plausible/builder.rb +5 -6
- data/lib/bridgetown-plausible/version.rb +1 -1
- data/lib/bridgetown-plausible.rb +11 -0
- data/release-please-config.json +11 -0
- metadata +19 -20
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 10343f5050a55a466fe11cd10ec55761b7053e7e1a67a81108f2805c9f4f6cb7
|
|
4
|
+
data.tar.gz: 904bb7ecfaa65c5cd1a973e9f845f05bde996eabec8174788e49d1c04e05a352
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9a2f9182c506d83656ade3fb971b1d3c74b6fc5e922a4ae78c3f9e8c404799f7ee55ffc94aab502a465f8cd6523579b6e8c66efff77359ba096cf6f103735978
|
|
7
|
+
data.tar.gz: a832d653bf4cabad842bd604bd5ee7a613b8052f6ee62582318a9f9edfcd239829605929d7523a63145ee328c6994fdf00afc49260db8afa6dbccfa7d5a117c9
|
data/.github/workflows/lint.yml
CHANGED
|
@@ -13,13 +13,11 @@ jobs:
|
|
|
13
13
|
runs-on: ubuntu-latest
|
|
14
14
|
if: "!contains(github.event.head_commit.message, 'ci skip')"
|
|
15
15
|
steps:
|
|
16
|
-
- uses: actions/checkout@
|
|
16
|
+
- uses: actions/checkout@v6
|
|
17
17
|
- name: Set up Ruby
|
|
18
18
|
uses: ruby/setup-ruby@v1
|
|
19
19
|
with:
|
|
20
|
-
ruby-version: 3.
|
|
20
|
+
ruby-version: "3.3"
|
|
21
|
+
bundler-cache: true
|
|
21
22
|
- name: Run bin/lint
|
|
22
|
-
run:
|
|
23
|
-
gem install bundler -v 2.2.7
|
|
24
|
-
bundle install
|
|
25
|
-
bin/lint
|
|
23
|
+
run: bin/lint
|
|
@@ -4,37 +4,34 @@ on:
|
|
|
4
4
|
push:
|
|
5
5
|
branches:
|
|
6
6
|
- main
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: write
|
|
10
|
+
pull-requests: write
|
|
11
|
+
|
|
7
12
|
jobs:
|
|
8
13
|
release-please:
|
|
9
14
|
runs-on: ubuntu-latest
|
|
10
15
|
steps:
|
|
11
|
-
- uses:
|
|
16
|
+
- uses: googleapis/release-please-action@v5
|
|
12
17
|
id: release
|
|
13
18
|
with:
|
|
14
19
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
version-file: "lib/bridgetown-plausible/version.rb"
|
|
19
|
-
- uses: actions/checkout@v2
|
|
20
|
+
config-file: release-please-config.json
|
|
21
|
+
manifest-file: .release-please-manifest.json
|
|
22
|
+
- uses: actions/checkout@v6
|
|
20
23
|
if: ${{ steps.release.outputs.release_created }}
|
|
21
24
|
- uses: ruby/setup-ruby@v1
|
|
22
25
|
with:
|
|
23
|
-
ruby-version: 3.
|
|
26
|
+
ruby-version: "3.3"
|
|
27
|
+
bundler-cache: true
|
|
24
28
|
if: ${{ steps.release.outputs.release_created }}
|
|
25
|
-
- run:
|
|
26
|
-
gem install bundler -v 2.2.7
|
|
27
|
-
bundle install
|
|
28
|
-
bundle exec rake
|
|
29
|
+
- run: bundle exec rake
|
|
29
30
|
if: ${{ steps.release.outputs.release_created }}
|
|
30
31
|
- name: release gem
|
|
31
32
|
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
33
|
gem build *.gemspec
|
|
37
34
|
gem push *.gem
|
|
38
35
|
env:
|
|
39
|
-
GEM_HOST_API_KEY:
|
|
36
|
+
GEM_HOST_API_KEY: ${{ secrets.RUBYGEMS_AUTH_TOKEN }}
|
|
40
37
|
if: ${{ steps.release.outputs.release_created }}
|
data/.github/workflows/test.yml
CHANGED
|
@@ -9,19 +9,31 @@ on:
|
|
|
9
9
|
- main
|
|
10
10
|
|
|
11
11
|
jobs:
|
|
12
|
-
|
|
12
|
+
test:
|
|
13
13
|
runs-on: ubuntu-latest
|
|
14
14
|
if: "!contains(github.event.head_commit.message, 'ci skip')"
|
|
15
|
+
strategy:
|
|
16
|
+
fail-fast: false
|
|
17
|
+
matrix:
|
|
18
|
+
include:
|
|
19
|
+
# Bridgetown 1.3 — oldest supported, sanity-check on newest Ruby
|
|
20
|
+
- { ruby: "3.1", bridgetown: "~> 1.3.4" }
|
|
21
|
+
- { ruby: "3.3", bridgetown: "~> 1.3.4" }
|
|
22
|
+
# Bridgetown 2.0 — first 2.x line (helper/filter scoping options deprecated)
|
|
23
|
+
- { ruby: "3.2", bridgetown: "~> 2.0.0" }
|
|
24
|
+
# Bridgetown 2.1 — Active Support removed (verifies .html_safe still works)
|
|
25
|
+
- { ruby: "3.2", bridgetown: "~> 2.1.0" }
|
|
26
|
+
# Bridgetown 2.2 — current
|
|
27
|
+
- { ruby: "3.3", bridgetown: "~> 2.2.0" }
|
|
28
|
+
env:
|
|
29
|
+
BRIDGETOWN_VERSION: ${{ matrix.bridgetown }}
|
|
15
30
|
steps:
|
|
16
|
-
- uses: actions/checkout@
|
|
31
|
+
- uses: actions/checkout@v6
|
|
17
32
|
- name: Set up Ruby
|
|
18
33
|
uses: ruby/setup-ruby@v1
|
|
19
34
|
with:
|
|
20
|
-
ruby-version:
|
|
35
|
+
ruby-version: ${{ matrix.ruby }}
|
|
36
|
+
bundler-cache: true
|
|
37
|
+
cache-version: "${{ matrix.ruby }}-${{ matrix.bridgetown }}"
|
|
21
38
|
- 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 }}
|
|
39
|
+
run: bundle exec rake
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,34 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [2.0.0](https://github.com/bt-rb/bridgetown-plausible/compare/bridgetown-plausible-v1.1.0...bridgetown-plausible/v2.0.0) (2026-05-21)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### ⚠ BREAKING CHANGES
|
|
7
|
+
|
|
8
|
+
* requires init :"bridgetown-plausible"; drops Bridgetown < 1.3 support. Users on older Bridgetown should stay on bridgetown-plausible 1.1.x.
|
|
9
|
+
|
|
10
|
+
### Features
|
|
11
|
+
|
|
12
|
+
* make server configurable ([#11](https://github.com/bt-rb/bridgetown-plausible/issues/11)) ([5c5cd29](https://github.com/bt-rb/bridgetown-plausible/commit/5c5cd296477bee6eb6ce38e32051968291995d44))
|
|
13
|
+
* support Bridgetown 2.x (and 1.3+) ([#15](https://github.com/bt-rb/bridgetown-plausible/issues/15))` ([28aa6f1](https://github.com/bt-rb/bridgetown-plausible/commit/28aa6f152d54640db0bd3eb5b59675dede49c137))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Bug Fixes
|
|
17
|
+
|
|
18
|
+
* correct logo url ([#1](https://github.com/bt-rb/bridgetown-plausible/issues/1)) ([22db435](https://github.com/bt-rb/bridgetown-plausible/commit/22db43569e90375c1895f20c232607a93f9bf023))
|
|
19
|
+
* correct test action name ([1d0526a](https://github.com/bt-rb/bridgetown-plausible/commit/1d0526a7eb1fe608dfba174b11b76490870d6dc2))
|
|
20
|
+
* fix gem name in release action ([a3614df](https://github.com/bt-rb/bridgetown-plausible/commit/a3614df2cdddea6314b9baddcb697b3aa07b0c7f))
|
|
21
|
+
* use correct link to repo in gemspec and render safe html ([#9](https://github.com/bt-rb/bridgetown-plausible/issues/9)) ([02e61b9](https://github.com/bt-rb/bridgetown-plausible/commit/02e61b9930240c3b2810627da1e4b357c7563b33))
|
|
22
|
+
* use correct package name in automation ([#10](https://github.com/bt-rb/bridgetown-plausible/issues/10)) ([82eb300](https://github.com/bt-rb/bridgetown-plausible/commit/82eb3002ce83d822cab96cbe722c1516635fa8dc)), closes [#6](https://github.com/bt-rb/bridgetown-plausible/issues/6) [#7](https://github.com/bt-rb/bridgetown-plausible/issues/7)
|
|
23
|
+
* use the correct url for the automation in our readme docs ([b2b5961](https://github.com/bt-rb/bridgetown-plausible/commit/b2b596132b4452d93cfca8e6227c82d766a8691d)), closes [#4](https://github.com/bt-rb/bridgetown-plausible/issues/4)
|
|
24
|
+
|
|
25
|
+
## [1.1.0](https://www.github.com/bt-rb/bridgetown-plausible/compare/v1.0.2...v1.1.0) (2022-09-22)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
### Features
|
|
29
|
+
|
|
30
|
+
* make server configurable ([#11](https://www.github.com/bt-rb/bridgetown-plausible/issues/11)) ([5c5cd29](https://www.github.com/bt-rb/bridgetown-plausible/commit/5c5cd296477bee6eb6ce38e32051968291995d44))
|
|
31
|
+
|
|
3
32
|
### [1.0.2](https://www.github.com/bt-rb/bridgetown-plausible/compare/v1.0.1...v1.0.2) (2021-12-22)
|
|
4
33
|
|
|
5
34
|
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
<p align="center">
|
|
8
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
|
|
9
|
+
<img src="https://img.shields.io/github/license/bt-rb/bridgetown-plausible" alt="license">
|
|
10
10
|
<img src="https://github.com/bt-rb/bridgetown-plausible/workflows/Test/badge.svg" alt="test">
|
|
11
11
|
<img src="https://github.com/bt-rb/bridgetown-plausible/workflows/Lint/badge.svg" alt="lint">
|
|
12
12
|
<img src="https://github.com/bt-rb/bridgetown-plausible/workflows/Release/badge.svg" alt="release">
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
- [Quickstart](#quickstart)
|
|
23
23
|
- [System requirements](#system-requirements)
|
|
24
24
|
- [Installation](#installation)
|
|
25
|
+
- [Upgrading from 1.x](#upgrading-from-1x)
|
|
25
26
|
- [Configuration](#configuration)
|
|
26
27
|
- [Usage](#usage)
|
|
27
28
|
- [Liquid](#liquid)
|
|
@@ -40,30 +41,56 @@ bundle exec bridgetown apply https://github.com/bt-rb/bridgetown-plausible
|
|
|
40
41
|
|
|
41
42
|
## System requirements
|
|
42
43
|
|
|
43
|
-
- Ruby >= `2.5`
|
|
44
44
|
- Bundler
|
|
45
|
-
-
|
|
45
|
+
- Ruby >= `3.1`
|
|
46
|
+
- Bridgetown >= `1.3` (tested against Bridgetown 1.3.x, 2.0.x, 2.1.x, and 2.2.x)
|
|
47
|
+
|
|
48
|
+
Bridgetown itself sets its own Ruby floor: 1.3.x needs `>= 2.7`, 2.0.x needs `>= 3.1`, 2.1.x and 2.2.x need `>= 3.2`. This gem requires `>= 3.1` to match what we test in CI; if you need Ruby 2.7 or 3.0 on Bridgetown 1.3, stay on `bridgetown-plausible "~> 1.1"`.
|
|
46
49
|
|
|
47
50
|
## Installation
|
|
48
51
|
|
|
49
|
-
|
|
52
|
+
Add to your `Gemfile`:
|
|
50
53
|
|
|
51
54
|
```bash
|
|
52
55
|
bundle add bridgetown-plausible -g bridgetown_plugins
|
|
53
56
|
```
|
|
54
57
|
|
|
55
|
-
or
|
|
58
|
+
or manually:
|
|
56
59
|
|
|
57
60
|
```ruby
|
|
58
61
|
group :bridgetown_plugins do
|
|
59
|
-
gem "bridgetown-plausible", "~>
|
|
62
|
+
gem "bridgetown-plausible", "~> 2.0"
|
|
63
|
+
end
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Then configure the plugin in your `config/initializers.rb` — the recommended path is to pass your domain (and self-hosted server, if applicable) inline:
|
|
67
|
+
|
|
68
|
+
```ruby
|
|
69
|
+
Bridgetown.configure do |config|
|
|
70
|
+
# ...your existing config...
|
|
71
|
+
|
|
72
|
+
init :"bridgetown-plausible" do
|
|
73
|
+
domain "example.com"
|
|
74
|
+
# server "stats.example.com" # optional, defaults to plausible.io
|
|
75
|
+
end
|
|
60
76
|
end
|
|
61
77
|
```
|
|
62
78
|
|
|
63
|
-
|
|
79
|
+
Alternatively, you can configure via `bridgetown.config.yml` (see [Configuration](#configuration) below) and use the bare `init :"bridgetown-plausible"` form. Precedence is per-key: any kwarg you pass overrides the matching YAML key, and keys you don't pass continue to come from YAML. So passing only `domain` in the init block will still pick up `server` from `bridgetown.config.yml` if it's set there.
|
|
80
|
+
|
|
81
|
+
## Upgrading from 1.x
|
|
82
|
+
|
|
83
|
+
Version 2.0 is a breaking change:
|
|
84
|
+
|
|
85
|
+
- **Requires Bridgetown >= 1.3.** If you're on an older Bridgetown, stay on `bridgetown-plausible "~> 1.1"` until you can upgrade.
|
|
86
|
+
- **The gem no longer auto-registers on `require`.** You must explicitly opt in by adding `init :"bridgetown-plausible"` to your `config/initializers.rb` (see [Installation](#installation)). Without this, builds calling `<%= plausible %>` will raise `NameError: undefined local variable or method 'plausible'`, and `{% plausible %}` will raise `Liquid::SyntaxError`.
|
|
87
|
+
- **Ruby >= 3.1** (matching what we test in CI). See [System requirements](#system-requirements) for the per-Bridgetown-version Ruby floors set by Bridgetown itself.
|
|
88
|
+
- **Active Support was removed from Bridgetown in 2.1.** The plugin's `.html_safe` calls continue to work via `bridgetown-foundation`, which Bridgetown ships by default — no action needed.
|
|
64
89
|
|
|
65
90
|
## Configuration
|
|
66
91
|
|
|
92
|
+
You can configure via the initializer kwargs shown in [Installation](#installation), or via `bridgetown.config.yml`:
|
|
93
|
+
|
|
67
94
|
```yml
|
|
68
95
|
# bridgetown.config.yml
|
|
69
96
|
|
|
@@ -74,11 +101,19 @@ plausible:
|
|
|
74
101
|
# Type: String
|
|
75
102
|
# Required: true
|
|
76
103
|
domain: example.com
|
|
104
|
+
# Your Plausible instance domain.
|
|
105
|
+
# Only set this if you are self-hosting Plausible on your own domain.
|
|
106
|
+
# Requires https.
|
|
107
|
+
#
|
|
108
|
+
# Type: String
|
|
109
|
+
# Required: false
|
|
110
|
+
# Default: "plausible.io"
|
|
111
|
+
server: selfhosted-plausible.com
|
|
77
112
|
```
|
|
78
113
|
|
|
79
114
|
## Usage
|
|
80
115
|
|
|
81
|
-
This plugin provides the `plausible` Liquid tag & ERB helper to your site. If `BRIDGETOWN_ENV` is not `production`,
|
|
116
|
+
This plugin provides the `plausible` Liquid tag & ERB helper to your site. If `BRIDGETOWN_ENV` is not `production`, then the tag will be wrapped in an HTML comment to prevent console errors in development. Make sure you set `BRIDGETOWN_ENV="production"` when you deploy in your script or in Netlify/Vercel/etc.
|
|
82
117
|
|
|
83
118
|
Use the tag in the head of your document:
|
|
84
119
|
|
|
@@ -106,4 +141,4 @@ Please make sure to read the [Contributing Guide](.github/CONTRIBUTING.md) befor
|
|
|
106
141
|
|
|
107
142
|
[MIT](https://opensource.org/licenses/MIT)
|
|
108
143
|
|
|
109
|
-
Copyright (c)
|
|
144
|
+
Copyright (c) 2020-2026, Andrew Mason
|
data/Rakefile
CHANGED
|
@@ -8,7 +8,7 @@ Gem::Specification.new do |spec|
|
|
|
8
8
|
spec.authors = ["Andrew Mason"]
|
|
9
9
|
spec.email = ["andrewmcodes@protonmail.com"]
|
|
10
10
|
spec.summary = "Plausible Analytics Plugin for Bridgetown"
|
|
11
|
-
spec.description = "
|
|
11
|
+
spec.description = "Provides a Liquid Tag and ERB Helper to add Plausible analytics to your Bridgetown site."
|
|
12
12
|
spec.homepage = "https://github.com/bt-rb/#{spec.name}"
|
|
13
13
|
spec.license = "MIT"
|
|
14
14
|
spec.metadata = {
|
|
@@ -16,18 +16,18 @@ Gem::Specification.new do |spec|
|
|
|
16
16
|
"changelog_uri" => "#{spec.homepage}/blob/main/CHANGELOG.md",
|
|
17
17
|
"documentation_uri" => spec.homepage.to_s,
|
|
18
18
|
"homepage_uri" => spec.homepage.to_s,
|
|
19
|
-
"source_code_uri" => spec.homepage.to_s
|
|
19
|
+
"source_code_uri" => spec.homepage.to_s,
|
|
20
|
+
"rubygems_mfa_required" => "true"
|
|
20
21
|
}
|
|
21
22
|
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
23
|
spec.require_paths = ["lib"]
|
|
24
|
-
spec.required_ruby_version = Gem::Requirement.new(">=
|
|
24
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 3.1.0")
|
|
25
25
|
|
|
26
|
-
spec.add_dependency "bridgetown", ">=
|
|
26
|
+
spec.add_dependency "bridgetown", ">= 1.3"
|
|
27
27
|
|
|
28
28
|
spec.add_development_dependency "bundler"
|
|
29
|
-
spec.add_development_dependency "nokogiri", "~> 1.
|
|
29
|
+
spec.add_development_dependency "nokogiri", "~> 1.16"
|
|
30
30
|
spec.add_development_dependency "rake", "~> 13.0"
|
|
31
31
|
spec.add_development_dependency "rspec", "~> 3.0"
|
|
32
|
-
spec.add_development_dependency "standard", "~>
|
|
32
|
+
spec.add_development_dependency "standard", "~> 1.41"
|
|
33
33
|
end
|
data/bridgetown.automation.rb
CHANGED
|
@@ -1,16 +1,37 @@
|
|
|
1
1
|
say_status :plausible, "Installing the bridgetown-plausible plugin..."
|
|
2
2
|
|
|
3
3
|
domain_name = ask("What's your Plausible domain?")
|
|
4
|
-
|
|
4
|
+
server_name = ask("If you are self-hosting Plausible, what's your instance domain? Leave blank if not self-hosting to default to plausible.io")
|
|
5
5
|
add_bridgetown_plugin "bridgetown-plausible"
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
<<~
|
|
7
|
+
init_block = if server_name.to_s.strip.empty?
|
|
8
|
+
<<~RUBY
|
|
9
|
+
|
|
10
|
+
init :"bridgetown-plausible" do
|
|
11
|
+
domain #{domain_name.inspect}
|
|
12
|
+
end
|
|
13
|
+
RUBY
|
|
14
|
+
else
|
|
15
|
+
<<~RUBY
|
|
16
|
+
|
|
17
|
+
init :"bridgetown-plausible" do
|
|
18
|
+
domain #{domain_name.inspect}
|
|
19
|
+
server #{server_name.inspect}
|
|
20
|
+
end
|
|
21
|
+
RUBY
|
|
22
|
+
end
|
|
9
23
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
24
|
+
if File.exist?("config/initializers.rb")
|
|
25
|
+
if File.read("config/initializers.rb").include?(%(init :"bridgetown-plausible"))
|
|
26
|
+
say_status :plausible, "config/initializers.rb already calls `init :\"bridgetown-plausible\"` — skipping."
|
|
27
|
+
else
|
|
28
|
+
# Indent the init block to match the surrounding Bridgetown.configure block
|
|
29
|
+
indented = init_block.lines.map { |l| (l == "\n") ? l : " #{l}" }.join
|
|
30
|
+
inject_into_file "config/initializers.rb", indented, before: /^end\s*\z/
|
|
31
|
+
end
|
|
32
|
+
else
|
|
33
|
+
say_status :plausible, "config/initializers.rb not found. bridgetown-plausible 2.x requires Bridgetown >= 1.3."
|
|
34
|
+
say_status :plausible, "Upgrade Bridgetown to 1.3+ (and configure via config/initializers.rb), or use bridgetown-plausible `~> 1.1` for older Bridgetown sites."
|
|
13
35
|
end
|
|
14
36
|
|
|
15
|
-
say_status :plausible, "All set!
|
|
16
|
-
say_status :plausible, "https://github.com/bt-rb/bridgetown-plausible"
|
|
37
|
+
say_status :plausible, "All set! Review docs at https://github.com/bt-rb/bridgetown-plausible"
|
data/demo/Gemfile
CHANGED
data/demo/bridgetown.config.yml
CHANGED
|
@@ -27,4 +27,12 @@ plausible:
|
|
|
27
27
|
#
|
|
28
28
|
# Type: String
|
|
29
29
|
# Required: true
|
|
30
|
-
domain:
|
|
30
|
+
domain: tracked-site.com
|
|
31
|
+
# Your Plausible instance domain.
|
|
32
|
+
# Only set this if you are self-hosting Plausible on your own domain.
|
|
33
|
+
# Requires https.
|
|
34
|
+
#
|
|
35
|
+
# Type: String
|
|
36
|
+
# Required: false
|
|
37
|
+
# Default: "plausible.io"
|
|
38
|
+
server: selfhosted-plausible.com
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
<title>{{ metadata.title }}</title>
|
|
7
7
|
<meta name="description" content="{{ metadata.description }}" />
|
|
8
8
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/mini.css/3.0.1/mini-default.min.css">
|
|
9
|
+
{% plausible %}
|
|
9
10
|
</head>
|
|
10
11
|
<body class="{{ page.layout }} {{ page.page_class }}">
|
|
11
12
|
<header>
|
|
@@ -17,12 +17,13 @@ module Bridgetown
|
|
|
17
17
|
|
|
18
18
|
def render
|
|
19
19
|
domain = options.dig(:domain)&.strip
|
|
20
|
+
server = options.dig(:server)&.strip || "plausible.io"
|
|
20
21
|
|
|
21
22
|
tag = if domain
|
|
22
|
-
|
|
23
|
+
markup_for_snippet(domain, server)
|
|
23
24
|
else
|
|
24
25
|
Bridgetown.logger.warn "Plausible", "Domain not configured."
|
|
25
|
-
|
|
26
|
+
markup_for_snippet("NOT CONFIGURED", server)
|
|
26
27
|
end
|
|
27
28
|
|
|
28
29
|
return wrap_with_comment(tag) unless Bridgetown.environment.production?
|
|
@@ -30,8 +31,8 @@ module Bridgetown
|
|
|
30
31
|
tag
|
|
31
32
|
end
|
|
32
33
|
|
|
33
|
-
def
|
|
34
|
-
"<script async defer data-domain=\"#{domain}\" src=\"https
|
|
34
|
+
def markup_for_snippet(domain, server)
|
|
35
|
+
"<script async defer data-domain=\"#{domain}\" src=\"https://#{server}/js/plausible.js\"></script>"
|
|
35
36
|
end
|
|
36
37
|
|
|
37
38
|
def wrap_with_comment(tag)
|
|
@@ -44,5 +45,3 @@ module Bridgetown
|
|
|
44
45
|
end
|
|
45
46
|
end
|
|
46
47
|
end
|
|
47
|
-
|
|
48
|
-
Bridgetown::Plausible::Builder.register
|
data/lib/bridgetown-plausible.rb
CHANGED
|
@@ -2,3 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
require "bridgetown"
|
|
4
4
|
require "bridgetown-plausible/builder"
|
|
5
|
+
require "bridgetown-plausible/version"
|
|
6
|
+
|
|
7
|
+
Bridgetown.initializer :"bridgetown-plausible" do |config, domain: nil, server: nil|
|
|
8
|
+
# `config.set` deep-merges the new hash into any existing one (e.g. from bridgetown.config.yml),
|
|
9
|
+
# so per-key precedence works as expected: kwargs override matching YAML keys, and any keys not
|
|
10
|
+
# passed as kwargs survive from YAML.
|
|
11
|
+
overrides = {"domain" => domain, "server" => server}.compact
|
|
12
|
+
config.set "plausible", overrides if overrides.any?
|
|
13
|
+
|
|
14
|
+
config.builder Bridgetown::Plausible::Builder
|
|
15
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"packages": {
|
|
3
|
+
".": {
|
|
4
|
+
"release-type": "ruby",
|
|
5
|
+
"package-name": "bridgetown-plausible",
|
|
6
|
+
"bump-minor-pre-major": true,
|
|
7
|
+
"version-file": "lib/bridgetown-plausible/version.rb"
|
|
8
|
+
}
|
|
9
|
+
},
|
|
10
|
+
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json"
|
|
11
|
+
}
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: bridgetown-plausible
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 2.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Andrew Mason
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2026-05-21 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bridgetown
|
|
@@ -16,20 +16,14 @@ dependencies:
|
|
|
16
16
|
requirements:
|
|
17
17
|
- - ">="
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: '
|
|
20
|
-
- - "<"
|
|
21
|
-
- !ruby/object:Gem::Version
|
|
22
|
-
version: '2.0'
|
|
19
|
+
version: '1.3'
|
|
23
20
|
type: :runtime
|
|
24
21
|
prerelease: false
|
|
25
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
26
23
|
requirements:
|
|
27
24
|
- - ">="
|
|
28
25
|
- !ruby/object:Gem::Version
|
|
29
|
-
version: '
|
|
30
|
-
- - "<"
|
|
31
|
-
- !ruby/object:Gem::Version
|
|
32
|
-
version: '2.0'
|
|
26
|
+
version: '1.3'
|
|
33
27
|
- !ruby/object:Gem::Dependency
|
|
34
28
|
name: bundler
|
|
35
29
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -50,14 +44,14 @@ dependencies:
|
|
|
50
44
|
requirements:
|
|
51
45
|
- - "~>"
|
|
52
46
|
- !ruby/object:Gem::Version
|
|
53
|
-
version: '1.
|
|
47
|
+
version: '1.16'
|
|
54
48
|
type: :development
|
|
55
49
|
prerelease: false
|
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
|
57
51
|
requirements:
|
|
58
52
|
- - "~>"
|
|
59
53
|
- !ruby/object:Gem::Version
|
|
60
|
-
version: '1.
|
|
54
|
+
version: '1.16'
|
|
61
55
|
- !ruby/object:Gem::Dependency
|
|
62
56
|
name: rake
|
|
63
57
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -92,15 +86,16 @@ dependencies:
|
|
|
92
86
|
requirements:
|
|
93
87
|
- - "~>"
|
|
94
88
|
- !ruby/object:Gem::Version
|
|
95
|
-
version: '
|
|
89
|
+
version: '1.41'
|
|
96
90
|
type: :development
|
|
97
91
|
prerelease: false
|
|
98
92
|
version_requirements: !ruby/object:Gem::Requirement
|
|
99
93
|
requirements:
|
|
100
94
|
- - "~>"
|
|
101
95
|
- !ruby/object:Gem::Version
|
|
102
|
-
version: '
|
|
103
|
-
description:
|
|
96
|
+
version: '1.41'
|
|
97
|
+
description: Provides a Liquid Tag and ERB Helper to add Plausible analytics to your
|
|
98
|
+
Bridgetown site.
|
|
104
99
|
email:
|
|
105
100
|
- andrewmcodes@protonmail.com
|
|
106
101
|
executables: []
|
|
@@ -115,6 +110,7 @@ files:
|
|
|
115
110
|
- ".github/workflows/release.yml"
|
|
116
111
|
- ".github/workflows/test.yml"
|
|
117
112
|
- ".gitignore"
|
|
113
|
+
- ".release-please-manifest.json"
|
|
118
114
|
- ".rspec"
|
|
119
115
|
- CHANGELOG.md
|
|
120
116
|
- Gemfile
|
|
@@ -130,6 +126,7 @@ files:
|
|
|
130
126
|
- bridgetown.automation.rb
|
|
131
127
|
- demo/Gemfile
|
|
132
128
|
- demo/bridgetown.config.yml
|
|
129
|
+
- demo/config/initializers.rb
|
|
133
130
|
- demo/plugins/builders/.keep
|
|
134
131
|
- demo/plugins/site_builder.rb
|
|
135
132
|
- demo/src/404.html
|
|
@@ -142,6 +139,7 @@ files:
|
|
|
142
139
|
- lib/bridgetown-plausible.rb
|
|
143
140
|
- lib/bridgetown-plausible/builder.rb
|
|
144
141
|
- lib/bridgetown-plausible/version.rb
|
|
142
|
+
- release-please-config.json
|
|
145
143
|
homepage: https://github.com/bt-rb/bridgetown-plausible
|
|
146
144
|
licenses:
|
|
147
145
|
- MIT
|
|
@@ -151,7 +149,8 @@ metadata:
|
|
|
151
149
|
documentation_uri: https://github.com/bt-rb/bridgetown-plausible
|
|
152
150
|
homepage_uri: https://github.com/bt-rb/bridgetown-plausible
|
|
153
151
|
source_code_uri: https://github.com/bt-rb/bridgetown-plausible
|
|
154
|
-
|
|
152
|
+
rubygems_mfa_required: 'true'
|
|
153
|
+
post_install_message:
|
|
155
154
|
rdoc_options: []
|
|
156
155
|
require_paths:
|
|
157
156
|
- lib
|
|
@@ -159,15 +158,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
159
158
|
requirements:
|
|
160
159
|
- - ">="
|
|
161
160
|
- !ruby/object:Gem::Version
|
|
162
|
-
version:
|
|
161
|
+
version: 3.1.0
|
|
163
162
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
164
163
|
requirements:
|
|
165
164
|
- - ">="
|
|
166
165
|
- !ruby/object:Gem::Version
|
|
167
166
|
version: '0'
|
|
168
167
|
requirements: []
|
|
169
|
-
rubygems_version: 3.
|
|
170
|
-
signing_key:
|
|
168
|
+
rubygems_version: 3.5.22
|
|
169
|
+
signing_key:
|
|
171
170
|
specification_version: 4
|
|
172
171
|
summary: Plausible Analytics Plugin for Bridgetown
|
|
173
172
|
test_files: []
|