Skip to content

Commit

Permalink
Merge pull request #765 from alexwlchan/posts-not-articles
Browse files Browse the repository at this point in the history
Use the posts collection, not articles
  • Loading branch information
alexwlchan authored Apr 7, 2024
2 parents a5376e2 + b2611f9 commit 3296de4
Show file tree
Hide file tree
Showing 439 changed files with 18 additions and 93 deletions.
5 changes: 0 additions & 5 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,9 @@ sass:
# Collections config
# ==================
#
# I create two collections in the site: one of articles, one of TILs.
# See https://jekyllrb.com/docs/collections/ for more info.

collections:
articles:
output: true
permalink: "/:year/:title/"

til:
output: true
permalink: "/til/:year/:title/"
Expand Down
2 changes: 1 addition & 1 deletion front-matter.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"layout": {
"description": "Which layout template to use.",
"type": "string",
"enum": ["article", "page", "post", "til"]
"enum": ["page", "post", "til"]
},
"title": {
"description": "The title of the page or the post.",
Expand Down
6 changes: 3 additions & 3 deletions scripts/linter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,9 @@ def check_yaml_front_matter(src_dir)

errors[md_path] = md_errors unless md_errors.empty?

if md_path.start_with?('src/_articles/') || md_path.start_with?('src/_drafts')
if front_matter['layout'] != 'post' && front_matter['layout'] != 'article'
errors[md_path] <<= "layout should be 'article' or 'post'; got #{front_matter['layout']}"
if md_path.start_with?('src/_posts/') || md_path.start_with?('src/_drafts')
if front_matter['layout'] != 'post'
errors[md_path] <<= "layout should be 'post'; got #{front_matter['layout']}"
end
elsif md_path.start_with?('src/_til/')
if front_matter['layout'] != 'til'
Expand Down
70 changes: 0 additions & 70 deletions src/_layouts/article.html

This file was deleted.

2 changes: 1 addition & 1 deletion src/_plugins/card_images.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
require_relative 'pillow/convert_image'

Jekyll::Hooks.register :site, :post_read do |site|
site.collections['articles'].docs.each do |post|
site.posts.docs.each do |post|
year = post.date.year
slug = post.data['slug']

Expand Down
10 changes: 5 additions & 5 deletions src/_plugins/visible_tags.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@
Jekyll::Hooks.register :site, :post_read do |site|
tag_tally = Hash.new(0)

site.collections['articles'].docs.each do |article|
next if article.data.fetch('index', {}).fetch('exclude', false)
site.posts.docs.each do |post|
next if post.data.fetch('index', {}).fetch('exclude', false)

article.data['tags'].each do |tag|
post.data['tags'].each do |tag|
tag_tally[tag] += 1
end
end

visible_tags = tag_tally.select { |_, count| count > 1 }.keys.to_set

site.collections['articles'].docs.each do |article|
article.data['visible_tags'] = article.data['tags'].select { |t| visible_tags.include? t }
site.posts.docs.each do |post|
post.data['visible_tags'] = post.data['tags'].select { |t| visible_tags.include? t }
end
end
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
layout: article
layout: post
date: 2013-01-10 00:41:00 +0000
summary: An essay about the number zero that I wrote for school.
tags:
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

1 comment on commit 3296de4

@alexwlchan
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉 Published on https://alexwlchan.net as production
🚀 Deployed on https://6612eba84a79d1ecd548786f--alexwlchan.netlify.app

Please sign in to comment.