diff --git a/.github/workflows/jekyll.yml b/.github/workflows/jekyll.yml index cb890b9..1ffb834 100644 --- a/.github/workflows/jekyll.yml +++ b/.github/workflows/jekyll.yml @@ -1,56 +1,63 @@ -# This workflow uses actions that are not certified by GitHub. -# They are provided by a third-party and are governed by -# separate terms of service, privacy policy, and support -# documentation. - -# Sample workflow for building and deploying a Jekyll site to GitHub Pages name: Deploy Jekyll site to Pages -on: - # Runs on pushes targeting the default branch - push: - branches: ["gh-pages"] - - # Allows you to run this workflow manually from the Actions tab - workflow_dispatch: - -# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages -permissions: - contents: read - pages: write - id-token: write - # Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. # However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. concurrency: group: "pages" cancel-in-progress: false +on: + push: + branches: + - master + +env: + RUBY_VERSION: 3.2 + +# Define a job named `build-and-publish` in your workflow. jobs: - # Build job - build: - runs-on: ubuntu-latest + build-and-publish: + runs-on: ubuntu-latest # This job uses a GitHub-hosted runner. + + # env: + # BUNDLE_PATH: "vendor/bundle" + # BUNDLE_JOBS: 4 + # BUNDLE_RETRY: 3 + + # Skip builds with "[ci skip]" in the commit + if: "!contains(github.event.head_commit.message, '[ci skip]')" + steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Setup Pages - uses: actions/configure-pages@v3 - - name: Build with Jekyll - uses: actions/jekyll-build-pages@v1 + - uses: actions/checkout@v3 + - uses: ruby/setup-ruby@v1 with: - source: ./ - destination: ./_site - - name: Upload artifact - uses: actions/upload-pages-artifact@v1 - - # Deployment job - deploy: - environment: - name: github-pages - url: ${{ steps.deployment.outputs.page_url }} - runs-on: ubuntu-latest - needs: build - steps: + ruby-version: ${{ env.RUBY_VERSION }} + bundler-cache: true + - name: Clone target branch + run: | + REMOTE_BRANCH="${REMOTE_BRANCH:-gh-pages}" + REMOTE_REPO="https://${GITHUB_ACTOR}:${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git" + + echo "Publishing to ${GITHUB_REPOSITORY} on branch ${REMOTE_BRANCH}" + rm -rf _site/ + git clone --depth=1 --branch="${REMOTE_BRANCH}" --single-branch --no-checkout \ + "${REMOTE_REPO}" _site/ + - name: Build site + run: bundle exec jekyll build --destination _site --verbose --trace + env: + # For jekyll-github-metadata + JEKYLL_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Deploy to GitHub Pages - id: deployment - uses: actions/deploy-pages@v1 + run: | + SOURCE_COMMIT="$(git log -1 --pretty="%an: %B" "$GITHUB_SHA")" + pushd _site &>/dev/null + : > .nojekyll + + git add --all + git -c user.name="${GITHUB_ACTOR}" -c user.email="${GITHUB_ACTOR}@users.noreply.github.com" \ + commit --quiet \ + --message "Deploy site from ${GITHUB_SHA}" \ + --message "$SOURCE_COMMIT" + git push + + popd &>/dev/null diff --git a/Gemfile b/Gemfile index 804d538..21514de 100644 --- a/Gemfile +++ b/Gemfile @@ -4,6 +4,7 @@ gem "jekyll", "~> 4.3.2" gem "jekyll-feed" gem "jekyll-gist" gem "jekyll-github-metadata" +gem "jekyll-paginate-v2" gem "jekyll-redirect-from" gem "jekyll-sitemap" gem "jemoji" diff --git a/Gemfile.lock b/Gemfile.lock index 6f781be..015f442 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -52,6 +52,8 @@ GEM jekyll-github-metadata (2.15.0) jekyll (>= 3.4, < 5.0) octokit (~> 4.0, != 4.4.0) + jekyll-paginate-v2 (3.0.0) + jekyll (>= 3.0, < 5.0) jekyll-redirect-from (0.16.0) jekyll (>= 3.3, < 5.0) jekyll-sass-converter (3.0.0) @@ -74,9 +76,9 @@ GEM rb-inotify (~> 0.9, >= 0.9.10) mercenary (0.4.0) minitest (5.19.0) - nokogiri (1.16.2-arm64-darwin) + nokogiri (1.15.5-arm64-darwin) racc (~> 1.4) - nokogiri (1.16.2-x86_64-linux) + nokogiri (1.15.5-x86_64-linux) racc (~> 1.4) octokit (4.25.1) faraday (>= 1, < 3) @@ -115,6 +117,7 @@ DEPENDENCIES jekyll-feed jekyll-gist jekyll-github-metadata + jekyll-paginate-v2 jekyll-redirect-from jekyll-sitemap jemoji diff --git a/_config.yml b/_config.yml index b3cc1ec..38ad7f3 100644 --- a/_config.yml +++ b/_config.yml @@ -25,11 +25,13 @@ timezone: 'America/New_York' # Permalink settings permalink: '/:year/:title/' -# Pagination settings Tried enabling this on 2022-01-24 and found it requires -# moving from post.html => post/index.html for permalinks. Not sure I want to -# just yet -# paginate: 10 -# paginate_path: 'browse/page:num' +# Pagination settings +pagination: + enabled: true + per_page: 10 + permalink: '/page:num/' + title: ':title - page :num' + sort_reverse: true # Files to exclude exclude: @@ -54,6 +56,7 @@ plugins: - jekyll-feed - jekyll-gist - jekyll-github-metadata + - jekyll-paginate-v2 - jekyll-redirect-from - jekyll-sitemap - jemoji diff --git a/_includes/head.html b/_includes/head.html index d570352..ef41aba 100644 --- a/_includes/head.html +++ b/_includes/head.html @@ -1,5 +1,5 @@ {%- assign asset_hash = site.time | date: "%s" -%} -{%- if page.title -%} +{%- if page.title and (page.title != site.title) -%} {%- assign page_title = page.title | append: " --- " | append: site.title | smartify -%} {%- else -%} {%- assign page_title = site.title | smartify -%} diff --git a/_includes/paginator.html b/_includes/paginator.html index 9793c2a..b623faf 100644 --- a/_includes/paginator.html +++ b/_includes/paginator.html @@ -1,17 +1,15 @@ -{% if site.paginate %} -