diff options
-rw-r--r-- | Gemfile | 7 | ||||
-rw-r--r-- | _config.yml | 3 | ||||
-rw-r--r-- | _data/git.yml | 9 | ||||
-rw-r--r-- | _includes/outdated.html | 5 | ||||
-rw-r--r-- | _layouts/default.html | 2 | ||||
-rw-r--r-- | _plugins/filters.rb | 4 | ||||
-rw-r--r-- | _plugins/meta.rb | 4 | ||||
-rw-r--r-- | _sass/layout.scss | 7 | ||||
-rw-r--r-- | _sass/theme.scss | 21 | ||||
-rw-r--r-- | script.js | 8 |
10 files changed, 52 insertions, 18 deletions
@@ -4,9 +4,8 @@ source 'https://rubygems.org' gem 'jekyll', '~> 4.3' gem 'json', '~> 2.7' gem 'nokogiri', '~> 1.16' -gem 'jekyll-liquify', '~> 0.0.3' -gem 'logger', '~> 1.6', '>= 1.6.5' -gem 'base64', '~> 0.2.0' -gem 'csv', '~> 3.3', '>= 3.3.2' +gem 'logger' +gem 'base64' +gem 'csv' diff --git a/_config.yml b/_config.yml index 6d8c836..99573cc 100644 --- a/_config.yml +++ b/_config.yml @@ -21,6 +21,5 @@ markdown: kramdown sass: style: compressed sourcemap: development -gems: - - jekyll-liquify +stale_threshold: 63072000 # 2 years diff --git a/_data/git.yml b/_data/git.yml index 7dbce91..fe8c22f 100644 --- a/_data/git.yml +++ b/_data/git.yml @@ -2,5 +2,10 @@ # edit counts, and is used to ignore commits where git sees a file as touched # even though its content hasn't changed. ignore_commits: - - ce37824c5260dd370c61cf174ea80ca7deeb1058 # next.js -> jekyll - - 7593175d2fc1acfeff315106099b663c251a51af # remove thumbnails + # transition from next.js to jekyll + - ce37824c5260dd370c61cf174ea80ca7deeb1058 + - b07eb8d1c06e582e5f177c159d820778029a9d93 + - dee0b16c1cdf18d205ffcb738eda0e9049396fd0 + # remove thumbnails + - 7593175d2fc1acfeff315106099b663c251a51af + diff --git a/_includes/outdated.html b/_includes/outdated.html new file mode 100644 index 0000000..2840b70 --- /dev/null +++ b/_includes/outdated.html @@ -0,0 +1,5 @@ +<blockquote class="admonition hidden" x-unhide-after="{{ include.date | date: "%s" | plus: site.stale_threshold }}"> + <p class="title">Warning</p> + <p>This post was last updated on {{ include.date | datefmt }}, and may no + longer contain accurate or up-to-date information.</p> +</blockquote> diff --git a/_layouts/default.html b/_layouts/default.html index fa4902f..9a48c60 100644 --- a/_layouts/default.html +++ b/_layouts/default.html @@ -13,6 +13,7 @@ <title>{{ site.title }}</title> {% endif %} <link rel="stylesheet" href="/style.css"> + <script src="/script.js" defer></script> </head> <body> <header class="invert plainlink"> @@ -33,6 +34,7 @@ </nav> <article class="limitwidth content"> {% if page.toc %}{% toc %}{% endif %} + {% if page.post %}{% include outdated.html date=page.date %}{% endif %} {{ content }} </article> {% if page.post %} diff --git a/_plugins/filters.rb b/_plugins/filters.rb index c4ee527..78eb04f 100644 --- a/_plugins/filters.rb +++ b/_plugins/filters.rb @@ -15,9 +15,9 @@ module Filters def post_sort(posts, sort_by) # date (reverse chronological) - return posts.sort_by{ |post| -post.date.to_i } if sort_by == "date" + return posts.sort_by{ |post| -post.data['date'].to_i } if sort_by == "date" # title (case insensitive) - return posts.sort_by{ |post| post.title.downcase } if sort_by == "title" + return posts.sort_by{ |post| post.data['title'].downcase } if sort_by == "title" end end diff --git a/_plugins/meta.rb b/_plugins/meta.rb index 28afd13..0e25871 100644 --- a/_plugins/meta.rb +++ b/_plugins/meta.rb @@ -6,7 +6,7 @@ class Meta < Jekyll::Generator posts = site.collections['items'] for page in posts do # convert generated page metadata and add directly to `page.meta` in liquid - page.data['meta'] = transform_data(site, page.slug) + page.data['meta'] = transform_data(site, page.data['slug']) # set page.authors to author metadata from git+yaml page.data['authors'] = site.data['authors'].filter do |author| @@ -53,7 +53,7 @@ class Meta < Jekyll::Generator # tally tags for post in posts do - for tag in post.tags do + for tag in post.data['tags'] do tags[tag] = tags.fetch(tag, 0) + 1 end end diff --git a/_sass/layout.scss b/_sass/layout.scss index 39b9189..f944710 100644 --- a/_sass/layout.scss +++ b/_sass/layout.scss @@ -77,6 +77,8 @@ summary::marker { cursor: pointer; } blockquote { position: relative; padding-left: 12px; + margin-top: 24px; + margin-bottom: 24px; } blockquote, figure { @@ -86,8 +88,8 @@ blockquote, figure { pre { overflow-x: auto; - border-radius: 6px; - padding: 6px 8px; + border-radius: 10px; + padding: 6px 10px; } figure figcaption { @@ -127,3 +129,4 @@ table { margin-right: auto; } +.hidden { display: none; } diff --git a/_sass/theme.scss b/_sass/theme.scss index 2bb6437..290cc8e 100644 --- a/_sass/theme.scss +++ b/_sass/theme.scss @@ -1,15 +1,27 @@ blockquote { font-style: italic; opacity: .8; + --color: currentcolor; } blockquote::before { content: ""; position: absolute; left: 0; - top: 0; - bottom: 0; + top: -4px; + bottom: -4px; width: 2px; - background-color: currentcolor; + background-color: var(--color); +} +blockquote p { + margin: 1ex 0; +} +blockquote.admonition { + font-style: unset; + opacity: unset; +} +blockquote.admonition .title { + font-weight: bold; + color: var(--color); } // navbar colors @@ -38,7 +50,8 @@ aside { border-left: 1px dashed; } pre { border: 1px solid; } -.title { font-size: 150%; } +header .title { font-size: 150%; } +footer .title { font-size: 120%; } .plainlink a, .plainlink a:visited { color: inherit; } diff --git a/script.js b/script.js new file mode 100644 index 0000000..d424c04 --- /dev/null +++ b/script.js @@ -0,0 +1,8 @@ +{ + let now = Date.now() / 1000; + document.querySelectorAll("[x-unhide-after]").forEach(el => { + if (now > el.getAttribute("x-unhide-after")) + el.classList.remove("hidden"); + }); +} + |