From dbea24696ef7bd27b8d317389b4b1f64af26c7b8 Mon Sep 17 00:00:00 2001 From: Fabian Aguilar Gomez Date: Tue, 2 Jan 2024 16:07:20 -0600 Subject: [PATCH 1/7] Create publish-gem.yml --- .github/workflows/publish-gem.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 .github/workflows/publish-gem.yml diff --git a/.github/workflows/publish-gem.yml b/.github/workflows/publish-gem.yml new file mode 100644 index 00000000000..e48c355dad2 --- /dev/null +++ b/.github/workflows/publish-gem.yml @@ -0,0 +1,22 @@ +name: Publish Gem + +on: + release: + types: [released] + +jobs: + release: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Setup Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: '2.7.8' + - name: Build gem + run: | + gem build github-pages.gemspec + - name: Publish + run: | + gem push github-pages.gem --key ${{ secrets.PAGES_GEM_PUBLISH }} From 5cea62c2f6098ba8876c1ca80efc716bb1b92959 Mon Sep 17 00:00:00 2001 From: Fabian Aguilar Gomez Date: Wed, 3 Jan 2024 17:32:04 -0600 Subject: [PATCH 2/7] Update publish-gem.yml --- .github/workflows/publish-gem.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish-gem.yml b/.github/workflows/publish-gem.yml index e48c355dad2..2e939a01811 100644 --- a/.github/workflows/publish-gem.yml +++ b/.github/workflows/publish-gem.yml @@ -13,7 +13,7 @@ jobs: - name: Setup Ruby uses: ruby/setup-ruby@v1 with: - ruby-version: '2.7.8' + ruby-version: '3.2' - name: Build gem run: | gem build github-pages.gemspec From 58bf1e75a6e881a23ed7f4922b5b0465b0039573 Mon Sep 17 00:00:00 2001 From: Fabian Aguilar Gomez Date: Wed, 3 Jan 2024 17:34:55 -0600 Subject: [PATCH 3/7] Update ci.yaml --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index d9249a52545..0323d522ef3 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -10,7 +10,7 @@ jobs: - uses: actions/checkout@v2 - uses: ruby/setup-ruby@v1 with: - ruby-version: 2.7 + ruby-version: 3.2 bundler-cache: true - name: build run: script/bootstrap From 91732ecd65d9a368c1275aecda9c1dca2365ca3d Mon Sep 17 00:00:00 2001 From: Fabian Aguilar Gomez Date: Wed, 3 Jan 2024 17:36:09 -0600 Subject: [PATCH 4/7] Update validate-html --- script/validate-html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/validate-html b/script/validate-html index 43d8fca8945..8f51642ea54 100755 --- a/script/validate-html +++ b/script/validate-html @@ -20,7 +20,7 @@ def validate(file) return puts "Valid!" if results.errors.empty? - results.errors.each { |err| puts err.to_s } + results.errors.each { |err| puts err } exit 1 end From b14e2cb56a0f94b0f4f15e3bc3c5a1569c3fde26 Mon Sep 17 00:00:00 2001 From: Fabian Aguilar Gomez Date: Fri, 5 Jan 2024 12:48:59 -0600 Subject: [PATCH 5/7] Update CONTRIBUTING.md --- docs/CONTRIBUTING.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md index 37bc385828b..f59423126a9 100644 --- a/docs/CONTRIBUTING.md +++ b/docs/CONTRIBUTING.md @@ -77,6 +77,9 @@ At a high level, [the process for proposing changes](https://guides.github.com/i `script/cibuild` +## Publishing Gem +In order to publish the Gem bump the version in *this file*, commit, create a tag with the new version number, and finally push the commit and tag to the repo. + ## Code of conduct This project is governed by [the Contributor Covenant Code of Conduct](CODE_OF_CONDUCT.md). By participating, you are expected to uphold this code. From 024750c8764adb8c5f1bb1da8e15deb6ff2e35a4 Mon Sep 17 00:00:00 2001 From: bovlb <31326650+bovlb@users.noreply.github.com> Date: Tue, 14 Feb 2023 12:52:51 -0800 Subject: [PATCH 6/7] Use new Google snippet This should work with both old Universal Analytics (UA) and new Google Analytics v4 (GA4). Resolves #63 --- _includes/head-custom-google-analytics.html | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/_includes/head-custom-google-analytics.html b/_includes/head-custom-google-analytics.html index 8a3ae5c9ca1..839cb67291f 100644 --- a/_includes/head-custom-google-analytics.html +++ b/_includes/head-custom-google-analytics.html @@ -1,10 +1,10 @@ {% if site.google_analytics %} - + + {% endif %} From 21ea036f3053b61d92c4ad70edd86c7c093991ac Mon Sep 17 00:00:00 2001 From: Sohail Siadat Date: Thu, 29 Jan 2026 21:48:13 +0000 Subject: [PATCH 7/7] a solution for both legacy UA Google Analytics tracking ID and GA4 gtag This solution can be extended if we wanted to long-term support other tracking ID versions or variants. The user can just specify the property for their version/variant in _config.yml --- README.md | 4 +++- _includes/head-custom-google-analytics-v4.html | 11 +++++++++++ _includes/head-custom-google-analytics.html | 16 ++++++++-------- _includes/head-custom.html | 3 +++ 4 files changed, 25 insertions(+), 9 deletions(-) create mode 100644 _includes/head-custom-google-analytics-v4.html diff --git a/README.md b/README.md index 4c2fac074ba..14922872b5b 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,8 @@ Additionally, you may choose to set the following optional variables: ```yml show_downloads: ["true" or "false" (unquoted) to indicate whether to provide a download URL] -google_analytics: [Your Google Analytics tracking ID] +google_analytics_v4: [Your Google Analytics tracking ID if you use new Google Analytics v4 (GA4)] +google_analytics: [Your legacy Universal Analytics (UA) tracking ID, for backward compatibility] ``` ### Stylesheet @@ -71,6 +72,7 @@ If you'd like to change the theme's HTML layout: ### Customizing Google Analytics code Google has released several iterations to their Google Analytics code over the years since this theme was first created. If you would like to take advantage of the latest code, paste it into `_includes/head-custom-google-analytics.html` in your Jekyll site. +Alternatively, set `google_analytics_v4:` (for new Google Analytics v4; GA4) or `google_analytics:` (for old Universal Analytics; UA) in `_config.yml`. ### Overriding GitHub-generated URLs diff --git a/_includes/head-custom-google-analytics-v4.html b/_includes/head-custom-google-analytics-v4.html new file mode 100644 index 00000000000..6892f97f41f --- /dev/null +++ b/_includes/head-custom-google-analytics-v4.html @@ -0,0 +1,11 @@ +{% if site.google_analytics_v4 %} + + + +{% endif %} diff --git a/_includes/head-custom-google-analytics.html b/_includes/head-custom-google-analytics.html index 839cb67291f..8a3ae5c9ca1 100644 --- a/_includes/head-custom-google-analytics.html +++ b/_includes/head-custom-google-analytics.html @@ -1,10 +1,10 @@ {% if site.google_analytics %} - - + {% endif %} diff --git a/_includes/head-custom.html b/_includes/head-custom.html index 44cdb83f523..fdcf2a65811 100644 --- a/_includes/head-custom.html +++ b/_includes/head-custom.html @@ -4,7 +4,10 @@ {% include head-custom-theme-colors.html %} + {% include head-custom-google-analytics.html %} + +{% include head-custom-google-analytics-v4.html %}