jekyll-theme-console 0.5.0 → 0.5.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fce79df1a37fb335f98b3c8bdd335e79d92ef57f46912da2b38fa582a3bd9829
4
- data.tar.gz: ce234b9afbba1c227555777092bd70f527b4e4f24eed098dcb18234684f3ff71
3
+ metadata.gz: 76aace9cca1cba808b2ab9a9879320cf0485ac71fac5de9ccb5f0712a9cc8dd4
4
+ data.tar.gz: 389629ffe06d9651ed0ca4d80cb64dde233bd6ae6c6a6b9a750113a879b19860
5
5
  SHA512:
6
- metadata.gz: 5e4108a94e6c68a654c8feef20787ea538bd7a3197ead66723ebd85efc6472e47b0dbdbf8fd4002c41ab97763762173b0c09dab8ae26acafd3c8908b7e792ff1
7
- data.tar.gz: 9cbd86883fb80275e010148b363993629d15243b62c3bdf7c916d6a0bac8a4ab33727ac3fc5cabd5592bec3706e86a8194224b108ffb36112cb98a4060cfc9b5
6
+ metadata.gz: dd48dfdff02290eb74f67f554e07ea244f0b47ede559e217c507cd480429cb6fbd60650a36ae00967fe3920b9248bae402134b0eed5f39164c4318b86819b314
7
+ data.tar.gz: 47f2ccd5eaf425970f280c3f65dd31d1e7406aef6e9df7f6a67aa116561501839f7604665cb2e25e1de6ae2cb20a59a220fea496d6bab0cfa4511e85b3149eec
data/README.md CHANGED
@@ -70,10 +70,10 @@ To update the theme run `bundle update`.
70
70
  In addition to jekyll's default configuration options, you can provide:
71
71
  - `header_pages`: list of pages displayed in the navbar
72
72
  - `footer`: HTML string inserted at the end of the page
73
- - `google_analytics`: tracking id (only loaded in production when set)
74
73
  - `listen_for_clients_preferred_style`: allow users to pick light/dark based on OS preference
75
74
  - `style`: predefined color style (`dark` default, or `light`, `hacker`)
76
75
  - `disable_google_fonts`: set `true` to avoid loading fonts from Google and use system fonts only
76
+ - `tracking`: generic tracking config for any provider (Matomo, Plausible, etc.). See below.
77
77
 
78
78
  ```yaml
79
79
  header_pages:
@@ -84,9 +84,18 @@ style: dark # dark (default), light or hacker
84
84
  listen_for_clients_preferred_style: true # false (default) or true
85
85
 
86
86
  footer: 'follow us on <a href="https://twitter.com/xxx">twitter</a>'
87
-
88
- google_analytics: UA-NNNNNNNN-N
89
87
  disable_google_fonts: false
88
+
89
+ # Generic tracking (optional; loads only in production)
90
+ # tracking:
91
+ # script_src:
92
+ # - https://cdn.example.com/tracker.js
93
+ # async: true # default true
94
+ # defer: false # default false
95
+ # # Optional inline init snippet (requires CSP allowance if used)
96
+ # # init: |
97
+ # # window.myTracker=window.myTracker||function(){(window.myTracker.q=window.myTracker.q||[]).push(arguments)};
98
+ # # myTracker('init', { siteId: '12345' });
90
99
  ```
91
100
 
92
101
  ### front matter variables
@@ -122,14 +131,34 @@ If you want to customize this theme, follow this steps:
122
131
  This theme ships with a strict but practical CSP to improve security. By default it allows:
123
132
  - self-hosted content plus images from `https:` and `data:` URIs
124
133
  - Google Fonts (if not disabled)
125
- - Google Analytics (only when `google_analytics` is set, including inline init script)
126
134
 
127
- If you need additional sources (e.g., to embed iframes), extend the policy via `_config.yml`:
135
+ If you need additional sources (e.g., analytics beacons, external scripts, iframes), extend the policy via `_config.yml`:
128
136
 
129
137
  ```yaml
130
138
  csp_extra: "frame-src https:;"
131
139
  ```
132
140
 
141
+ Examples:
142
+
143
+ - Allow a Matomo/PIWIK setup hosted at `https://analytics.example.com`:
144
+
145
+ ```yaml
146
+ tracking:
147
+ script_src:
148
+ - https://analytics.example.com/matomo.js
149
+ # If you add an inline init snippet via `tracking.init`, also include 'unsafe-inline' in script-src.
150
+ csp_extra: "script-src 'self' https://analytics.example.com 'unsafe-inline'; connect-src 'self' https://analytics.example.com; img-src 'self' https://analytics.example.com;"
151
+ ```
152
+
153
+ - Allow Plausible (self-hosted at `https://plausible.example.com`):
154
+
155
+ ```yaml
156
+ tracking:
157
+ script_src:
158
+ - https://plausible.example.com/js/plausible.js
159
+ csp_extra: "script-src 'self' https://plausible.example.com; connect-src 'self' https://plausible.example.com;"
160
+ ```
161
+
133
162
  Tip: To remove the top border line in the menu, override CSS in your site (e.g., add a small stylesheet) with:
134
163
 
135
164
  ```css
data/_includes/head.html CHANGED
@@ -30,7 +30,7 @@
30
30
  {%- endif -%}
31
31
  {%- endif -%}
32
32
 
33
- {%- if jekyll.environment == 'production' and site.google_analytics -%}
34
- {%- include google-analytics.html -%}
33
+ {%- if jekyll.environment == 'production' and site.tracking -%}
34
+ {%- include tracker.html -%}
35
35
  {%- endif -%}
36
36
  </head>
@@ -0,0 +1,32 @@
1
+ {%- comment -%}
2
+ Generic tracker include.
3
+ Configure in _config.yml under `tracking`:
4
+ tracking:
5
+ script_src: "https://example.com/tracker.js" # or an array of URLs
6
+ async: true # optional, default: true
7
+ defer: false # optional
8
+ init: |
9
+ // Optional inline init snippet for your tracker
10
+ // e.g., window.myTracker('init', { siteId: '123' });
11
+
12
+ Notes:
13
+ - This file renders only in production (see head.html).
14
+ - If you use external scripts or inline init, you likely need to extend
15
+ the CSP via `csp_extra` in _config.yml (script-src/connect-src, etc.).
16
+ {%- endcomment -%}
17
+
18
+ {%- assign async_attr = site.tracking.async | default: true -%}
19
+ {%- assign defer_attr = site.tracking.defer | default: false -%}
20
+
21
+ {%- if site.tracking.script_src -%}
22
+ {%- assign _srcs = site.tracking.script_src -%}
23
+ {%- for s in _srcs -%}
24
+ <script{% if async_attr %} async{% endif %}{% if defer_attr %} defer{% endif %} src="{{ s }}"></script>
25
+ {%- endfor -%}
26
+ {%- endif -%}
27
+
28
+ {%- if site.tracking.init -%}
29
+ <script>
30
+ {{ site.tracking.init }}
31
+ </script>
32
+ {%- endif -%}
@@ -2,8 +2,9 @@
2
2
  <html lang="{{ page.lang | default: site.lang | default: 'en' }}">
3
3
  {%- comment -%}
4
4
  Build a practical CSP. It remains strict by default while allowing
5
- common use cases: external images and Google Fonts. If Google Analytics
6
- is enabled, allow its domains and inline init script.
5
+ common use cases like external images and Google Fonts.
6
+ If you need to permit additional script/connect sources (e.g., analytics),
7
+ extend via `csp_extra` in your _config.yml.
7
8
  {%- endcomment -%}
8
9
  {%- capture csp -%}
9
10
  default-src 'none';
@@ -16,11 +17,7 @@ font-src 'self' https://fonts.gstatic.com data:;
16
17
  media-src 'self';
17
18
  object-src 'none';
18
19
  child-src 'self';
19
- {%- if jekyll.environment == 'production' and site.google_analytics -%}
20
- script-src 'self' https://www.googletagmanager.com 'unsafe-inline';
21
- {%- else -%}
22
20
  script-src 'self';
23
- {%- endif -%}
24
21
  {%- endcapture -%}
25
22
  {%- capture csp_final -%}{{ csp | strip | replace: '\n', ' ' }} {%- if site.csp_extra %} {{ site.csp_extra }}{%- endif -%}{%- endcapture -%}
26
23
  <meta http-equiv="Content-Security-Policy" content="{{ csp_final | strip }}" />
@@ -2,7 +2,8 @@
2
2
  # Only the main Sass file needs front matter (the dashes are enough)
3
3
  ---
4
4
 
5
- @use "dark";
6
- @use "base";
5
+ // Use @import for compatibility with GitHub Pages (libsass)
6
+ @import "dark";
7
+ @import "base";
7
8
 
8
- @include dark.theme();
9
+ @include theme();
@@ -2,7 +2,8 @@
2
2
  # Only the main Sass file needs front matter (the dashes are enough)
3
3
  ---
4
4
 
5
- @use "hacker";
6
- @use "base";
5
+ // Use @import for compatibility with GitHub Pages (libsass)
6
+ @import "hacker";
7
+ @import "base";
7
8
 
8
- @include hacker.theme();
9
+ @include theme();
@@ -2,7 +2,8 @@
2
2
  # Only the main Sass file needs front matter (the dashes are enough)
3
3
  ---
4
4
 
5
- @use "light";
6
- @use "base";
5
+ // Use @import for compatibility with GitHub Pages (libsass)
6
+ @import "light";
7
+ @import "base";
7
8
 
8
- @include light.theme();
9
+ @include theme();
@@ -2,7 +2,8 @@
2
2
  # Only the main Sass file needs front matter (the dashes are enough)
3
3
  ---
4
4
 
5
- @use "nord";
6
- @use "base";
5
+ // Use @import for compatibility with GitHub Pages (libsass)
6
+ @import "nord";
7
+ @import "base";
7
8
 
8
- @include nord.theme();
9
+ @include theme();
data/assets/main.scss CHANGED
@@ -2,12 +2,15 @@
2
2
  # Only the main Sass file needs front matter (the dashes are enough)
3
3
  ---
4
4
 
5
- @use "light";
6
- @use "dark";
7
- @use "base";
5
+ // Use @import for compatibility with GitHub Pages (libsass)
6
+ @import "base";
8
7
 
9
- @include light.theme();
8
+ // Import light theme and include its variables first
9
+ @import "light";
10
+ @include theme();
10
11
 
12
+ // Then import dark theme and include inside media query
13
+ @import "dark";
11
14
  @media (prefers-color-scheme: dark) {
12
- @include dark.theme();
15
+ @include theme();
13
16
  }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-theme-console
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - b2a3e8
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-08-31 00:00:00.000000000 Z
11
+ date: 2025-09-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -76,9 +76,9 @@ files:
76
76
  - LICENSE.txt
77
77
  - README.md
78
78
  - _includes/footer.html
79
- - _includes/google-analytics.html
80
79
  - _includes/head.html
81
80
  - _includes/header.html
81
+ - _includes/tracker.html
82
82
  - _layouts/default.html
83
83
  - _layouts/home.html
84
84
  - _layouts/page.html
@@ -1,8 +0,0 @@
1
- <script async src="https://www.googletagmanager.com/gtag/js?id={{ site.google_analytics }}"></script>
2
- <script>
3
- window['ga-disable-{{ site.google_analytics }}'] = window.doNotTrack === "1" || navigator.doNotTrack === "1" || navigator.doNotTrack === "yes" || navigator.msDoNotTrack === "1";
4
- window.dataLayer = window.dataLayer || [];
5
- function gtag(){dataLayer.push(arguments);}
6
- gtag('js', new Date());
7
- gtag('config', '{{ site.google_analytics }}');
8
- </script>