Commit 4009835f authored by Jamie Tanna's avatar Jamie Tanna

Combine Indie post types into Microformats2 content type

As part of #572, I wanted to experiment with having all the Indie
content types (i.e. reply, bookmark, like).

This is twofold - firstly it was driven from the work to build my
Micropub endpoint, as it won't need some logic in there to determine the
correct content type to create within my site. But it was also to remove
the weird state where I was partly writing Microformats2-like properties
for my content, but also not very, because it was my own setup around it
as i.e. I didn't want to have to worry about doing that mapping.

This required quite a few changes, to reformat the existing content into
the new Microformats2 format.

We remove schema validation for the new content type as we want to be
doing that validation through the Micropub endpoint rather than in this
site.

Finally, we move the RSVP calendar to a custom output format, as we
can't use it under the RSVPs content type, as that doesn't exist any
more.

Additionally, resolve a bug with how datetimes are rendered.

Closes #572, #500.
parent 46933d1c
type: map
mapping:
'bookmark-of':
type: str
required: yes
length: { min: 1 }
'content':
type: str
required: yes
'date':
type: str
required: yes
length: { min: 1 }
'slug':
type: str
required: yes
length: { min: 1 }
'syndication':
type: seq
required: yes
sequence:
- type: map
mapping:
'text':
type: str
required: yes
length: { min: 1 }
'url':
type: str
required: yes
length: { min: 1 }
'tags':
type: seq
required: yes
sequence:
- type: str
'title':
type: str
required: yes
type: map
mapping:
'date':
type: str
required: yes
length: { min: 1 }
'like-of':
type: str
required: yes
length: { min: 1 }
'slug':
type: str
required: yes
length: { min: 1 }
'syndication':
type: seq
required: yes
sequence:
- type: map
mapping:
'text':
type: str
required: yes
length: { min: 1 }
'url':
type: str
required: yes
length: { min: 1 }
'tags':
type: seq
required: yes
sequence:
- type: str
type: map
mapping:
'content':
type: str
required: yes
'date':
type: str
required: yes
length: { min: 1 }
'slug':
type: str
required: yes
length: { min: 1 }
'summary':
type: str
required: yes
'syndication':
type: seq
required: yes
sequence:
- type: map
mapping:
'text':
type: str
required: yes
length: { min: 1 }
'url':
type: str
required: yes
length: { min: 1 }
'tags':
type: seq
required: yes
sequence:
- type: str
'title':
type: str
required: yes
type: map
mapping:
'content':
type: str
required: yes
'date':
type: str
required: yes
length: { min: 1 }
'reply-to':
type: str
required: yes
length: { min: 1 }
'slug':
type: str
required: yes
length: { min: 1 }
'syndication':
type: seq
required: yes
sequence:
- type: map
mapping:
'text':
type: str
required: yes
length: { min: 1 }
'url':
type: str
required: yes
length: { min: 1 }
'tags':
type: seq
required: yes
sequence:
- type: str
type: map
mapping:
'content':
type: str
required: yes
'date':
type: str
required: yes
length: { min: 1 }
'repost-of':
type: str
required: yes
length: { min: 1 }
'slug':
type: str
required: yes
length: { min: 1 }
'syndication':
type: seq
required: yes
sequence:
- type: map
mapping:
'text':
type: str
required: yes
length: { min: 1 }
'url':
type: str
required: yes
length: { min: 1 }
'tags':
type: seq
required: yes
sequence:
- type: str
type: map
mapping:
'content':
type: str
required: yes
'date':
type: str
required: yes
length: { min: 1 }
'rsvp':
type: str
required: yes
length: { min: 1 }
'slug':
type: str
required: yes
length: { min: 1 }
'syndication':
type: seq
required: yes
sequence:
- type: map
mapping:
'text':
type: str
required: yes
length: { min: 1 }
'url':
type: str
required: yes
length: { min: 1 }
'tags':
type: seq
required: yes
sequence:
- type: str
'u-url':
type: str
required: yes
length: { min: 1 }
'event':
type: map
required: no
mapping:
'name':
type: str
required: yes
'start':
type: str
required: yes
'end':
type: str
required: yes
'location':
type: map
required: yes
mapping:
'street_address':
type: str
required: yes
'locality':
type: str
required: yes
'postal_code':
type: str
required: no
'country_name':
type: str
required: yes
......@@ -36,18 +36,6 @@ def report_errors(all_errors)
true
end
def validate_json(schema, glob)
schema = YAML.load_file(".schema/#{schema}.yml")
validator = Kwalify::Validator.new(schema)
all_errors = {}
Dir.glob(glob).each do |filename|
document = JSON.parse(File.read(filename))
errors = validator.validate(document)
all_errors[filename] = errors unless errors.length.zero?
end
fail if report_errors(all_errors)
end
namespace :test do
desc 'Test links'
task :links do
......@@ -187,11 +175,6 @@ namespace :list do
end
namespace :validate do
desc 'Validate bookmarks are well-formed'
task :bookmarks do
validate_json('bookmark', 'content/bookmarks/*')
end
desc 'Validate posts are well-formed'
task :posts do
schema = YAML.load_file('.schema/post.yml')
......@@ -217,31 +200,6 @@ namespace :validate do
end
fail if report_errors(all_errors)
end
desc 'Validate likes are well-formed'
task :likes do
validate_json('note', 'content/notes/*')
end
desc 'Validate notes are well-formed'
task :notes do
validate_json('note', 'content/notes/*')
end
desc 'Validate replies are well-formed'
task :replies do
validate_json('reply', 'content/reply/*')
end
desc 'Validate reposts are well-formed'
task :reposts do
validate_json('repost', 'content/reposts/*')
end
desc 'Validate RSVPs are well-formed'
task :rsvps do
validate_json('rsvp', 'content/rsvps/*')
end
end
desc 'Create Bit.ly short URLs for a given article URL'
......@@ -285,6 +243,6 @@ task :new, [:title] do |_, args|
end
end
task validate: ['validate:bookmarks', 'validate:events', 'validate:likes', 'validate:notes', 'validate:posts', 'validate:replies', 'validate:reposts', 'validate:rsvps']
task validate: ['validate:events', 'validate:posts']
task default: ['validate', 'test']
......@@ -28,19 +28,15 @@ paginate = 25
IgnoreInFeeds = ["", "events", "projects", "talks"]
[permalinks]
bookmarks = "/bookmarks/:slug"
categories = "/categories/:title/"
events = "/:sections/:slug/"
likes = "/likes/:slug"
notes = "/notes/:slug"
mf2 = "/mf2/:filename/"
posts = "/posts/:year/:month/:day/:slug/"
reposts = "/reposts/:slug"
rsvps = "/rsvps/:slug"
tags = "/tags/:title/"
[outputs]
home = ["HTML", "RSS", "jsonFeed", "postFrequency"]
section = ["HTML", "Calendar"]
home = ["HTML", "RSS", "jsonFeed", "postFrequency", "rsvpCalendar"]
section = ["HTML", "eventsCalendar"]
[outputFormats]
[outputFormats.RSS]
......@@ -52,6 +48,12 @@ baseName = "feed"
[outputFormats.postFrequency]
mediaType = "application/json"
baseName = "post-frequency"
[outputFormats.eventsCalendar]
mediaType = "text/calendar"
baseName = "index"
[outputFormats.rsvpCalendar]
mediaType = "text/calendar"
baseName = "/rsvps/index"
[blackfriday]
# disable stupid "smart" quotes
......
{
"content": "In every programming language, there is a linting tool that can help pick up on some common style issues. ShellCheck isn't one of those - it's so much more!\n\nI've been using it for many years now, and since it came into my life it's honestly changed the way I use shell scripts. There have been so many pitfalls that I've avoided falling into since learning about them (and adding ShellCheck to my Vim linting setup.\n\nThis is a great read from Vidar, the ShellCheck author, about a case where it could've caught issues that caused the deletion of a production database!",
"date": "2019-05-31T22:11:30+0100",
"bookmark-of": "https://www.vidarholen.net/contents/blog/?p=746",
"slug": "0524e112-d1ff-4709-bb2a-da04832e0a65",
"syndication": [],
"tags": [
"shell",
"cli"
],
"title": ""
}
{
"content": "",
"date": "2019-07-17T13:04:35+0200",
"bookmark-of": "https://martinfowler.com/articles/is-quality-worth-cost.html",
"slug": "060bf1b6-ed66-4935-9085-2935465c2e0e",
"syndication": [],
"tags": [
"software-quality"
],
"title": "Is High Quality Software Worth the Cost?"
}
{
"bookmark-of": "https://gist.github.com/lizthegrey/9c21673f33186a9cc775464afbdce820",
"content": "This is a great writeup about how to harden your SSH setup using 2-factor authentication. Would really recommend it!",
"date": "2019-05-16T21:09:43+0100",
"slug": "06392958-d830-42c8-8f8b-3ae3e8d4d3e1",
"syndication": [
{
"text": "IndieNews",
"url": "https://news.indieweb.org/en"
},
{
"text": "/en/security",
"url": "https://indieweb.xyz/en/security"
}
],
"tags": [
"security",
"ssh"
],
"title": "Hardening SSH with 2fa"
}
{
"bookmark-of": "https://getdoingthings.com/discovering-the-indieweb/",
"content": "When I was promoting the last Homebrew Website Club on Twitter (https://twitter.com/JamieTanna/status/1138339357121744897), a friend of Craig's tweeted to mention to him about it. We then spent a couple of days talking about it - and boom, Craig is now running his own Homebrew Website Club on 18th July (https://getdoingthings.com/homebrew-website-club-barnsley-1/).\n\nLast night Craig posted this great post about joining the community and with some great explanations for newbies. Welcome, Craig!",
"date": "2019-06-27T08:24:08+0100",
"slug": "0b51d660-8848-4b1f-839b-c49bac102f51",
"syndication": [
{
"text": "IndieNews",
"url": "https://news.indieweb.org/en"
},
{
"text": "/en/indieweb",
"url": "https://indieweb.xyz/en/indieweb"
}
],
"tags": [
"indieweb"
],
"title": "Discovering the IndieWeb - Craig Burgess"
}
{
"bookmark-of": "https://medium.com/@loftio/what-the-tech-community-in-nottingham-means-to-me-f0fa17bb162",
"content": "This is one of those posts that sums up why the Nottingham tech community is so amazing - it's well worth a read, especially if you're not from Nottingham!",
"date": "2019-06-13T12:08:29+0100",
"slug": "154e3eb8-1bcb-492a-8058-35ca10948964",
"syndication": [],
"tags": [
"nottingham"
],
"title": "What the Tech Community in Nottingham means to me - Lex Lofthouse"
}
{
"content": "",
"date": "2019-07-18T15:33:04+0200",
"bookmark-of": "https://murze.be/the-story-behind-our-open-source-efforts",
"slug": "1c90e04f-7266-4ad7-88db-c07365b1a010",
"syndication": [],
"tags": [
"open-source"
],
"title": "The story behind our open source efforts"
}
{
"bookmark-of": "https://github.com/thoughtbot/guides/blob/master/security/application.md",
"content": "I found this when listening to episode 194 of the Bike Shed podcast: My PGP Shame. I'd only added this episode to my playlist as it was an interesting title, but listening to it, it was even better than I thought.\n\nThere was some great stuff in there about Thoughtbot's application security guide, linked, which is a definite must-read.\n\nMy favourite quote of the episode, though, is the following exchange:\n\n> I've got to be honest, how does anything work at all?\n> Oh computers don't work",
"date": "2019-05-27T22:58:22+0100",
"slug": "20319b0e-50f4-4120-9ff3-321662b84379",
"syndication": [
{
"text": "/en/security",
"url": "https://indieweb.xyz/en/security"
}
],
"tags": [
"security",
"podcasts"
],
"title": "Thoughtbot's Application Security Guide"
}
{
"content": "This is a resource I've used time and time again for getting straight-forward explanations of Free and Open Source licenses - I shared it in chat.indieweb.org the other day, so I thought I may as well share it here, too",
"date": "2019-06-27T21:07:28+0100",
"bookmark-of": "https://tldrlegal.com/",
"slug": "2045a47c-6eeb-45d2-9b32-d6f6340ebd81",
"syndication": [],
"tags": [
"licensing"
],
"title": "TL;DR Legal - Software Licenses in Plain English"
}
{
"content": "",
"date": "2019-06-23T21:38:58+0100",
"bookmark-of": "https://webmention.app/",
"slug": "26a6868d-4036-47f8-ab88-453c994f63cb",
"syndication": [],
"tags": [
"indieweb",
"webmention"
],
"title": ""
}
{
"content": "Tell Him is a really important post by Jameela Jamil - if you don't read this, I'm incredibly disappointed in you",
"date": "2019-05-31T22:22:59+0100",
"bookmark-of": "http://jameelajamil.co.uk/post/181263516735/tell-him-by-jameela-jamil",
"slug": "28ed5ecb-c8f0-4306-b968-ffa0bb68f41a",
"syndication": [],
"tags": [
"feminism"
],
"title": ""
}
{
"content": "",
"date": "2019-07-17T13:13:37+0200",
"bookmark-of": "https://www.newyorker.com/tech/annals-of-technology/can-indie-social-media-save-us",
"slug": "292ee492-8525-4086-a752-547259cbc3e1",
"syndication": [],
"tags": [
"indieweb",
"social-media"
],
"title": "Can 'Indie' Social Media Save Us?"
}
{
"content": "This is a really great post! I think it was Jess Rose's talk about it where I realised it was a thing and not just something I felt. Talking about it and making others aware of it is good, and I'm definitely going to steal some of her coping strategies",
"date": "2019-05-27T22:02:48+0100",
"bookmark-of": "https://carolgilabert.me/blog/impostor-syndrome",
"slug": "3795a083-dd41-4e5d-a1b2-ee989274d4d6",
"syndication": [],
"tags": [
"impostor-syndrome",
"events"
],
"title": ""
}
{
"content": "This is a really interesting article about the flaws in PGP - I don't have enough security backing and understanding to argue it, but it sounds legitimate. It's a surprise this isn't being talked about more if it is as bad as it is",
"date": "2019-07-18T11:50:09+0200",
"bookmark-of": "https://latacora.micro.blog/2019/07/16/the-pgp-problem.html",
"slug": "3e948715-9b71-46eb-8277-52e151f8801d",
"syndication": [],
"tags": [
"security",
"pgp"
],
"title": "The PGP Problem"
}
{
"content": "I've not had to debug that many .gitignore files in the past, but it's great to know how I would do it in the future",
"date": "2019-06-30T21:30:13+0100",
"bookmark-of": "https://blog.kennard.dev/2019-06-19-git-debug-gitignore/",
"slug": "3eb3fef2-4584-4fe2-9d0d-135f2de7d511",
"syndication": [],
"tags": [
"git"
],
"title": "Debugging the .gitignore file - Kennard"
}
{
"content": "Burnout sucks. There are a number of signs to pick up on it before it fully manifests which this article talks about. Having gone through it in the past, it's not something you want to go through, and can have some severely lasting effects that are hard to come back from.",
"date": "2019-05-31T22:29:51+0100",
"bookmark-of": "http://angersock.com/blog/2019/01/27/observations-on-burnout/",
"slug": "4c247fb5-aab5-4e58-aabc-0e5ad128ad4f",
"syndication": [],
"tags": [
"burnout",
"self-care"
],
"title": ""