Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use the posts collection, not articles #765

Merged
merged 3 commits into from
Apr 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
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
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
Loading