-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Adds pagination with jekyll-paginate-v3 - Switch to a custom CI builder - Add a monkey patch to hide some posts from the paginator
- Loading branch information
1 parent
4159e23
commit f4a317b
Showing
9 changed files
with
100 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,15 @@ | ||
{% if site.paginate %} | ||
<div class="pager"> | ||
<ul class="pagination"> | ||
{%- if paginator.previous_page %} | ||
<li><a href="{{ paginator.previous_page_path | relative_url }}" class="previous-page">{{ paginator.previous_page }}</a></li> | ||
{%- else %} | ||
<li><div class="pager-edge">•</div></li> | ||
{%- endif %} | ||
<li><div class="current-page">{{ paginator.page }}</div></li> | ||
{%- if paginator.next_page %} | ||
<li><a href="{{ paginator.next_page_path | relative_url }}" class="next-page">{{ paginator.next_page }}</a></li> | ||
{%- else %} | ||
<li><div class="pager-edge">•</div></li> | ||
{%- endif %} | ||
</ul> | ||
</div> | ||
{%- endif %} | ||
{% if paginator.total_pages > 1 %} | ||
<div class="pager"> | ||
{%- if paginator.previous_page %} | ||
<a href="{{ paginator.previous_page_path | relative_url }}" class="previous-page">← Previous</a> :: | ||
{%- endif %} | ||
|
||
{%- if paginator.page > 1 %} | ||
<span class="current-page">Page {{ paginator.page }}</span> | ||
{%- endif %} | ||
|
||
{%- if paginator.next_page %} | ||
{% unless paginator.page == 1 %}::{% endunless %} <a href="{{ paginator.next_page_path | relative_url }}" class="next-page">Next →</a> | ||
{%- endif %} | ||
</div> | ||
{% endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
require "jekyll-paginate-v2" | ||
|
||
# Exclude posts with categories archive, vault, or an archive attribute set | ||
Jekyll::PaginateV2::Generator::PaginationModel.prepend Module.new { | ||
def paginate(template, config, site_title, all_posts, all_tags, all_categories, all_locales) | ||
all_posts.reject! do |post| | ||
%w(archive vault).include?(post["category"].to_s) || post["archive"] | ||
end | ||
|
||
super | ||
end | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -201,3 +201,7 @@ | |
padding-left: calc(#{$spacing-unit} / 2); | ||
} | ||
} | ||
|
||
.pager { | ||
text-align: center; | ||
} |