-
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.
== GitHub Actions workflow == This commit introduces a soft dependency on the jekyll-archives plugin. A non-blog site can continue to use Amethyst without it, in which case any blog-specific page layout might not work correctly. The jekyll-archive Gem package is a first-party plugin from the Jekyll community. But, it not included in the github-pages Gem. As such, in order to use it we have to opt-out from the default Jekyll deployment that GitHub Pages offers, and instead deploy it as a static site that we build ourselves from a GitHub Actions worflow (run Jekyll and commit files to a branch). This is becoming a more common pattern in the community already, due to github-pages also lagginb behind in other features (and still on the Jekyll 3.x series). == 404 == I have tried to most URL patterns currently used by WordPress as configured on blog.jquery.com. But, a few URLs will likely become 404, and I noticed Amethyst did not yet have a custom 404 page. This commit adds one, so as to ensure the visitor stays within the site and can use the search feature (instead of ending up on a generic Nginx or GitHub 404 error page). == Features == * Blog post rendering with semantic HTML, microdata hCard, and other aspects that help accessible technology to understand and focus on the content, proper display in "Reader Mode" of Firefox and Safari, and SEO. * Basic comment rendering with Gravatar. * Index by tag. * Index by year. * Sidebar modules for tag list, recent posts, and yearly archives. Not implemented: * Pagination. The WordPress blog rendered full post contents on index pages, which made them quite long and difficult to scan. In Amethyst, I've rendered only excerpts on index pages, which makes them much more scannable I think and for the most part forgoes the need for pagination. There is only so much in any given year or category. For the home page, we list the 10 most recent posts, and then link to an even more minimal archive index where all posts are linked with only their title and date in a bullet list (not even an excerpt). * Authors don't have dedicated pages. I considered giving authors pages like for tags, but this conflicted with jekyll-feed. And the data-based author index that jekyll-feed supports doesn't result in dedicated pages. Rather than a messy workaround, perhaps it's not something we need, so long as the author information itself is preserved. * Archive indexes by year only, not by month. There typically aren't that many posts and it seemed to make for rather long and clunky navigation. I have compensated by making the archive indexes render the post excerpt only, thus making them very scannable. * Comment authors are plain text (no external link for commenter URL). * Comment dates have day-level precision (no hours/minutes/seconds).
- Loading branch information
Showing
41 changed files
with
663 additions
and
12 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 |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: GitHub Pages | ||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
deploy: | ||
name: Deploy | ||
runs-on: ubuntu-20.04 | ||
env: | ||
DEPLOY_DIR: _site/ | ||
DEPLOY_BRANCH: gh-pages | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Prepare branch | ||
run: | | ||
mkdir "${DEPLOY_DIR}" | ||
cd "${DEPLOY_DIR}" | ||
# Clone and checkout existing branch, or initialise with a new and empty branch | ||
git clone --depth 5 --branch "${DEPLOY_BRANCH}" "https://github.com/${GITHUB_REPOSITORY}.git" . || git init -b "${DEPLOY_BRANCH}" | ||
- uses: ruby/setup-ruby@v1 | ||
# If your site is in a subdirectory | ||
# working-directory: ./ | ||
with: | ||
ruby-version: 2.7 | ||
bundler-cache: true | ||
|
||
- name: Jekyll build | ||
# If your site is in a subdirectory | ||
# working-directory: ./ | ||
run: bundle exec jekyll build | ||
|
||
- name: Push to branch | ||
# Inspired by https://github.com/helaili/jekyll-action/blob/2.2.0/entrypoint.sh | ||
env: | ||
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | ||
run: | | ||
cd "${DEPLOY_DIR}" | ||
touch .nojekyll | ||
git config user.name "${GITHUB_ACTOR}" && \ | ||
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" && \ | ||
git add . && \ | ||
git commit --allow-empty -m "Build commit ${GITHUB_SHA}" && \ | ||
git push "https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" "HEAD:${DEPLOY_BRANCH}" |
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,3 +1,4 @@ | ||
/.jekyll-cache/ | ||
/.sass-cache/ | ||
/_site/ | ||
/Gemfile.lock |
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,9 @@ | ||
--- | ||
layout: page | ||
title: Page not found | ||
permalink: /404.html | ||
amethyst: | ||
hero: false | ||
--- | ||
|
||
<p class="lead" markdown="1">It seems we can’t find what you’re looking for.</p> |
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,8 +1,17 @@ | ||
source "https://rubygems.org" | ||
ruby RUBY_VERSION | ||
|
||
gem 'github-pages', group: :jekyll_plugins | ||
gem 'jekyll-algolia', "1.7.0", group: :jekyll_plugins | ||
gem "jekyll", "~> 4.2.0" | ||
gem "kramdown-parser-gfm", "1.1.0" | ||
gem "jekyll-redirect-from", "~> 0.16.0", group: :jekyll_plugins | ||
gem "jekyll-remote-theme", "~> 0.4.3", group: :jekyll_plugins | ||
|
||
# Temporary fix for https://github.com/github/pages-gem/issues/752 | ||
# Blog | ||
gem "jekyll-feed", "~> 0.15.1", group: :jekyll_plugins | ||
gem "jekyll-archives", "~> 2.2.1", group: :jekyll_plugins | ||
|
||
# Search | ||
gem "jekyll-algolia", "~> 1.7.0", group: :jekyll_plugins | ||
|
||
# Temporary fix until there is a release with https://github.com/jekyll/jekyll/pull/8524/ | ||
gem "webrick", "~> 1.7" |
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,11 @@ | ||
- type: tags | ||
title: Tags | ||
expand: true | ||
|
||
- type: recent | ||
title: Recent posts | ||
expand: true | ||
|
||
- type: archive | ||
title: Archives | ||
expand: true |
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 |
---|---|---|
|
@@ -5,5 +5,7 @@ | |
href: /intro/ | ||
- name: Documentation | ||
href: /api/ | ||
- name: Blog | ||
href: /blog/ | ||
- name: About | ||
href: /about/ |
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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
--- | ||
layout: wrapper | ||
--- | ||
|
||
<div class="main main--columns wrapper"> | ||
{% include sidebar.html blocks="sidebar_blog" %} | ||
<div class="content"> | ||
<article class="content"> | ||
<header> | ||
<h1>{{ page.title | escape }}</h1> | ||
{%- assign date_format = site.amethyst.date_format | default: "%e %B %Y" -%} | ||
<p class="post-meta byline">Posted on <time itemprop="pubdate" datetime="{{ page.date | date_to_xmlschema }}">{{ page.date | date: date_format }}</time>{% if page.author %} by <span class="vcard"><span class="fn n" rel="author">{{ page.author | escape }}</span>{% endif %}</p> | ||
</header> | ||
{{ content }} | ||
</article> | ||
{%- comment -%} | ||
Support basic read-only rendering of imported comments. | ||
|
||
Docs: <https://en.gravatar.com/site/implement/images/> | ||
{%- endcomment -%} | ||
{%- if page.amethyst.comments.size > 0 -%} | ||
<div id="comments" class="comments"> | ||
<h2 id="comments-title">{{ page.amethyst.comments.size }} archived comment{% if page.amethyst.comments.size != 1 %}s{% endif %}</h2> | ||
<ol class="comment-list"> | ||
{%- for comment in page.amethyst.comments -%} | ||
<li class="comment" id="comment-{{ forloop.index }}"> | ||
<div class="comment-meta"> | ||
<img alt="" src="https://gravatar.com/avatar/{{ comment.gravatar | default: 'none' }}?s=68&d=mm&r=g" srcset="https://gravatar.com/avatar/{{ comment.gravatar | default: 'none' }}?s=136&d=mm&r=g 2x" class="comment-avatar" loading="lazy" width="68" height="68"> | ||
<span class="comment-author">{{ comment.author | escape }}</span> on <a href="#comment-{{ forloop.index }}"><time datetime="{{ comment.date | date_to_xmlschema }}">{{ comment.date | date: date_format }}</time></a> said:</div> | ||
<div class="comment-content">{{ comment.content | markdownify }}</div> | ||
</li> | ||
{%- endfor -%} | ||
</ol> | ||
</div> | ||
{%- endif -%} | ||
</div> | ||
</div> |
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,17 @@ | ||
--- | ||
layout: wrapper | ||
--- | ||
|
||
<div class="main main--columns wrapper"> | ||
{% include sidebar.html blocks="sidebar_blog" %} | ||
{%- assign date_format = site.amethyst.date_format | default: "%e %B %Y" -%} | ||
{%- assign posts = site.posts -%} | ||
<div class="posts content"> | ||
<h1>{{ page.title }}</h1> | ||
<ul> | ||
{% for post in posts -%} | ||
<li><a href="{{ post.url | relative_url }}">{{ post.title | escape }}</a>, <time datetime="{{ post.date | date_to_xmlschema }}">{{ post.date | date: date_format }}</time>.</li> | ||
{%- endfor -%} | ||
</ul> | ||
</div> | ||
</div> |
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,21 @@ | ||
--- | ||
layout: wrapper | ||
--- | ||
|
||
<div class="main main--columns wrapper"> | ||
{% include sidebar.html blocks="sidebar_blog" %} | ||
{%- assign date_format = site.amethyst.date_format | default: "%e %B %Y" -%} | ||
{%- assign posts = site.posts | where: 'author', page.author -%} | ||
<div class="posts content"> | ||
<h1>Author: {{ page.title | escape }}</h1> | ||
{%- for post in posts -%} | ||
<div class="post-row"> | ||
<h2><a href="{{ post.url | relative_url }}">{{ post.title | escape }}</a></h2> | ||
<p class="post-meta">Posted on <time datetime="{{ post.date | date_to_xmlschema }}">{{ post.date | date: date_format }}</time></p> | ||
<div class="post"> | ||
{{- post.excerpt -}} | ||
</div> | ||
</div> | ||
{%- endfor -%} | ||
</div> | ||
</div> |
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,24 @@ | ||
--- | ||
layout: wrapper | ||
--- | ||
|
||
<div class="main main--columns wrapper"> | ||
{% include sidebar.html blocks="sidebar_blog" %} | ||
{%- assign date_format = site.amethyst.date_format | default: "%e %B %Y" -%} | ||
{%- assign posts = site.tags[page.tag] -%} | ||
<div class="posts content"> | ||
<h1>Tag: {{ page.title | escape }}</h1> | ||
{%- for post in posts -%} | ||
<div class="post-row"> | ||
<h2><a href="{{ post.url | relative_url }}">{{ post.title | escape }}</a></h2> | ||
<p class="post-meta">Posted on <time datetime="{{ post.date | date_to_xmlschema }}">{{ post.date | date: date_format }}</time>{% if post.author %} by {{ post.author | escape }}{% endif %}</p> | ||
<div class="post"> | ||
{{- post.excerpt -}} | ||
{%- if post.excerpt != post.content %} | ||
<a class="screen-reader-text" href="{{ post.url | relative_url }}">Continue reading "{{ post.title | escape }}".</a> | ||
{%- endif -%} | ||
</div> | ||
</div> | ||
{%- endfor -%} | ||
</div> | ||
</div> |
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,24 @@ | ||
--- | ||
layout: wrapper | ||
--- | ||
|
||
<div class="main main--columns wrapper"> | ||
{% include sidebar.html blocks="sidebar_blog" %} | ||
{%- assign date_format = site.amethyst.date_format | default: "%e %B %Y" -%} | ||
{%- assign posts = page.posts -%} | ||
<div class="posts content"> | ||
<h1>Archive: {{ page.date | date: '%Y' }}</h1> | ||
{%- for post in posts -%} | ||
<div class="post-row"> | ||
<h2><a href="{{ post.url | relative_url }}">{{ post.title | escape }}</a></h2> | ||
<p class="post-meta">Posted on <time datetime="{{ post.date | date_to_xmlschema }}">{{ post.date | date: date_format }}</time>{% if post.author %} by {{ post.author | escape }}{% endif %}</p> | ||
<div class="post"> | ||
{{- post.excerpt -}} | ||
{%- if post.excerpt != post.content %} | ||
<a class="screen-reader-text" href="{{ post.url | relative_url }}">Continue reading "{{ post.title | escape }}".</a> | ||
{%- endif -%} | ||
</div> | ||
</div> | ||
{%- endfor -%} | ||
</div> | ||
</div> |
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,28 @@ | ||
--- | ||
layout: wrapper | ||
--- | ||
|
||
<div class="main main--columns wrapper"> | ||
{% include sidebar.html blocks="sidebar_blog" %} | ||
{%- assign date_format = site.amethyst.date_format | default: "%e %B %Y" -%} | ||
{%- assign posts = site.posts | slice: 0, 10 -%} | ||
<div class="posts content"> | ||
<h1>{{ page.title }}</h1> | ||
{% for post in posts -%} | ||
<div class="post-row"> | ||
<h2><a href="{{ post.url | relative_url }}">{{ post.title | escape }}</a></h2> | ||
<p class="post-meta">Posted on <time datetime="{{ post.date | date_to_xmlschema }}">{{ post.date | date: date_format }}</time>{% if post.author %} by {{ post.author | escape }}{% endif %}</p> | ||
<div class="post"> | ||
{{- post.excerpt -}} | ||
{%- if post.excerpt != post.content %} | ||
<a class="screen-reader-text" href="{{ post.url | relative_url }}">Continue reading "{{ post.title | escape }}".</a> | ||
{%- endif -%} | ||
</div> | ||
</div> | ||
{%- endfor -%} | ||
{%- assign archive_page = site.pages | where: "layout", "posts-archive" | first -%} | ||
{%- if site.posts.size > 10 and archive_page %} | ||
<a href="{{ archive_page.url | relative_url }}">Older posts</a> | ||
{%- endif -%} | ||
</div> | ||
</div> |
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
Oops, something went wrong.