diff --git a/.github/settings.yml b/.github/settings.yml
index 420815923f6..7c1b11592e1 100644
--- a/.github/settings.yml
+++ b/.github/settings.yml
@@ -26,6 +26,6 @@ branch_protection:
required_status_checks:
strict: true
contexts:
- - "continuous-integration/travis-ci"
+ - "script/cibuild" # GitHub Actions CI workflow
required_pull_request_reviews:
require_code_owner_reviews: true
diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
index 03fc0996aaa..0323d522ef3 100644
--- a/.github/workflows/ci.yaml
+++ b/.github/workflows/ci.yaml
@@ -1,13 +1,17 @@
-on: push
+on:
+ push:
+ pull_request:
+ types: [opened, synchronize]
jobs:
build:
runs-on: ubuntu-latest
name: script/cibuild
steps:
- uses: actions/checkout@v2
- - uses: actions/setup-ruby@v1
+ - uses: ruby/setup-ruby@v1
with:
- ruby-version: 2.7
+ ruby-version: 3.2
+ bundler-cache: true
- name: build
run: script/bootstrap
- name: test
diff --git a/.github/workflows/publish-gem.yml b/.github/workflows/publish-gem.yml
new file mode 100644
index 00000000000..2e939a01811
--- /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: '3.2'
+ - name: Build gem
+ run: |
+ gem build github-pages.gemspec
+ - name: Publish
+ run: |
+ gem push github-pages.gem --key ${{ secrets.PAGES_GEM_PUBLISH }}
diff --git a/.gitignore b/.gitignore
index 4c972ab54b0..822d5aaf017 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,3 +2,4 @@ _site
.sass-cache
Gemfile.lock
*.gem
+.jekyll-cache
diff --git a/.rubocop.yml b/.rubocop.yml
index 883e26e368c..15c823df623 100644
--- a/.rubocop.yml
+++ b/.rubocop.yml
@@ -1,9 +1,11 @@
+inherit_gem:
+ rubocop-github:
+ - config/default.yml
+
AllCops:
Exclude:
- _site/**/*
+ - vendor/**/*
-Metrics/LineLength:
- Enabled: false
-
-Gemspec/RequiredRubyVersion:
+Layout/LineLength:
Enabled: false
diff --git a/Gemfile b/Gemfile
index 7f4f5e950d1..be173b205f7 100644
--- a/Gemfile
+++ b/Gemfile
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-source 'https://rubygems.org/'
+source "https://rubygems.org/"
gemspec
diff --git a/README.md b/README.md
index 424e1097347..4c2fac074ba 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
# The Hacker theme
-[](https://travis-ci.org/pages-themes/hacker) [](https://badge.fury.io/rb/jekyll-theme-hacker)
+[](https://github.com/pages-themes/hacker/actions/workflows/ci.yaml) [](https://badge.fury.io/rb/jekyll-theme-hacker)
*Hacker is a Jekyll theme for GitHub Pages. You can [preview the theme to see what it looks like](http://pages-themes.github.io/hacker), or even [use it today](#usage).*
@@ -13,7 +13,9 @@ To use the Hacker theme:
1. Add the following to your site's `_config.yml`:
```yml
- theme: jekyll-theme-hacker
+ remote_theme: pages-themes/hacker@v0.2.0
+ plugins:
+ - jekyll-remote-theme # add this line to the plugins list if you already have one
```
2. Optionally, if you'd like to preview your site on your computer, add the following to your site's `Gemfile`:
@@ -36,7 +38,7 @@ description: [A short description of your site's purpose]
Additionally, you may choose to set the following optional variables:
```yml
-show_downloads: ["true" or "false" to indicate whether to provide a download URL]
+show_downloads: ["true" or "false" (unquoted) to indicate whether to provide a download URL]
google_analytics: [Your Google Analytics tracking ID]
```
@@ -60,10 +62,15 @@ If you'd like to add your own custom styles:
If you'd like to change the theme's HTML layout:
-1. [Copy the original template](https://github.com/pages-themes/hacker/blob/master/_layouts/default.html) from the theme's repository
(*Pro-tip: click "raw" to make copying easier*)
-2. Create a file called `/_layouts/default.html` in your site
-3. Paste the default layout content copied in the first step
-4. Customize the layout as you'd like
+1. For some changes such as a custom `favicon`, you can add custom files in your local `_includes` folder. The files [provided with the theme](https://github.com/pages-themes/hacker/tree/master/_includes) provide a starting point and are included by the [original layout template](https://github.com/pages-themes/hacker/blob/master/_layouts/default.html).
+2. For more extensive changes, [copy the original template](https://github.com/pages-themes/hacker/blob/master/_layouts/default.html) from the theme's repository
(*Pro-tip: click "raw" to make copying easier*)
+3. Create a file called `/_layouts/default.html` in your site
+4. Paste the default layout content copied in the first step
+5. Customize the layout as you'd like
+
+### 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.
### Overriding GitHub-generated URLs
@@ -106,4 +113,4 @@ If you'd like to preview the theme locally (for example, in the process of propo
### Running tests
-The theme contains a minimal test suite, to ensure a site with the theme would build successfully. To run the tests, simply run `script/cibuild`. You'll need to run `script/bootstrap` one before the test script will work.
+The theme contains a minimal test suite, to ensure a site with the theme would build successfully. To run the tests, simply run `script/cibuild`. You'll need to run `script/bootstrap` once before the test script will work.
diff --git a/_includes/head-custom-google-analytics.html b/_includes/head-custom-google-analytics.html
new file mode 100644
index 00000000000..8a3ae5c9ca1
--- /dev/null
+++ b/_includes/head-custom-google-analytics.html
@@ -0,0 +1,10 @@
+{% if site.google_analytics %}
+
+{% endif %}
diff --git a/_includes/head-custom-theme-colors.html b/_includes/head-custom-theme-colors.html
new file mode 100644
index 00000000000..a30e7084adf
--- /dev/null
+++ b/_includes/head-custom-theme-colors.html
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/_includes/head-custom.html b/_includes/head-custom.html
new file mode 100644
index 00000000000..44cdb83f523
--- /dev/null
+++ b/_includes/head-custom.html
@@ -0,0 +1,12 @@
+
+
+
+{% include head-custom-theme-colors.html %}
+
+
+{% include head-custom-google-analytics.html %}
+
+
+
+
+
diff --git a/_layouts/default.html b/_layouts/default.html
index aa651986a26..1c8c883a480 100644
--- a/_layouts/default.html
+++ b/_layouts/default.html
@@ -5,6 +5,7 @@
+ {% include head-custom.html %}
{% seo %}
@@ -33,16 +34,5 @@