betterplace-content 0.7.122 → 0.7.125

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/_layouts/default.html +13 -2
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5d2439f5b777a3f23029fdcedba7a68358feabbac89dffd972258f21be5e1d30
4
- data.tar.gz: 149553ed5a70bf946bd4649da59e80b2de7fadd3217678a3d2889d0b2d730757
3
+ metadata.gz: d084c61df4becd59c023de0e39275110342e8cff0556958e93a1bf33a6c1460e
4
+ data.tar.gz: 9553e8952cfdb4fbfa38a391e18bfdd690e122c3be8729674b860ac861a197dc
5
5
  SHA512:
6
- metadata.gz: f255c74d187b9dfbd0d8bcc86536a0bb71ccf9bfe020e5dd9da098accf2e569726d29891449c24d324fae4907e3cfe500c958da388610edc4fae4453342d1d3a
7
- data.tar.gz: 68051de67b2eacbf6bd85671d02cd781674e24a7cdce2243ae519e8d23c9b8019c7079e2e52fbfd6da9467fb504d6e422ad19c7f154766a6318e60d1a41d63e1
6
+ metadata.gz: 1bf04ac69f54b0ef487b7081655dc8ce8ff8589d43f51d0aa7ca44cb351ce475cbeefde475b5a3bd6b14b91769be82734a33039e1e5a2015cbb9c521b93672bf
7
+ data.tar.gz: bb4eb0727f13e60c90cd0d5ea1ce89e99122931d93854645ad094694211934bcbac1e9cbb919a4aa75e80922af864d2c602d5fa46f59f4e0139832263e98b79c
@@ -133,9 +133,20 @@ Update 2019-07-19: Another problem that came us is, that URLs endet in .html whi
133
133
  })
134
134
  })
135
135
 
136
- const replaceHost = () => {
136
+ const updateLinks = () => {
137
+ // attach utm params to bp links, except those that already have utm params
138
+ const utmParams = [...window.location.search.matchAll(/utm[^=]+=[^&]+/g)].join('&')
139
+ if (utmParams) {
140
+ document.querySelectorAll("a[href]").forEach(a => {
141
+ if (/(^\/|\.(bp|betterplace))(?!.*[?&]utm)/.test(a.href)) {
142
+ a.href = `${a.href}${a.href.includes('?') ? '&' : '?'}${utmParams}`
143
+ }
144
+ })
145
+ }
146
+
137
147
  if (/\.(?:org|dev|cloud)/.test(window.location.hostname)) return
138
148
 
149
+ // replace host, e.g. with staging host
139
150
  document.querySelectorAll("[href]").forEach(element => {
140
151
  if (element.href.includes('www.betterplace.org')) {
141
152
  element.href = element.href.replace('www.betterplace.org', window.location.hostname)
@@ -144,7 +155,7 @@ Update 2019-07-19: Another problem that came us is, that URLs endet in .html whi
144
155
  })
145
156
  }
146
157
 
147
- document.addEventListener('DOMContentLoaded', replaceHost)
158
+ document.addEventListener('DOMContentLoaded', updateLinks)
148
159
  </script>
149
160
  </body>
150
161
  </html>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: betterplace-content
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.122
4
+ version: 0.7.125
5
5
  platform: ruby
6
6
  authors:
7
7
  - betterplace.org Developers
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-10-19 00:00:00.000000000 Z
11
+ date: 2022-12-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll