aaronpk / p3k

This is a repository for filing issues against the software the runs my website. The source code is not public, but various components are.
https://aaronparecki.com/
MIT License
14 stars 0 forks source link

Separate storage of mentions from the actual posts #13

Closed aaronpk closed 10 years ago

aaronpk commented 10 years ago

Currently mentions of my posts are stored within the post file itself. (Only the URL and date are stored there, the actual mention content is stored using IndieArchive).

However this is causing some problems, mainly conflicts when updating post content since someone mentioning a post will cause the file to be updated too.

Instead, I want to store mentions of the URLs somewhere else, such as in a mirror file for each post. For example, if my post has a filename of content/notes/2013/11/01-1.md, then all mentions could be stored in a file mentions/notes/2013/11/01-1.yml.

sandeepshetty commented 10 years ago

You would still have to deal with concurrency issues on the mentions file. Why not deal with concurrency and leave them together?

aaronpk commented 10 years ago

Actually it wasn't the concurrency I was worried about, but yes you're right that I'll still have to deal with that.

The main problem I've been running into is when a new webmention is added on the server, and then I update the post content on my laptop. I have to merge the changes manually.

sandeepshetty commented 10 years ago

Ah, this is why I didn't go the static site generator route, especially cause I knew content would be added dynamically on the site and because it doesn't work too well on mobile phones.

aaronpk commented 10 years ago

This is now complete! All existing mentions have been migrated, and new mentions are being stored separately.

bcomnes commented 10 years ago

Separately, as in, indiearchive?

aaronpk commented 10 years ago

For a post with a filename on disk of ./content/notes/2014/01/19-1.md there is a corresponding file that contains references to the URLs that have mentioned that note, at ./mentions/notes/2014/01/19/1/indieweb-micropub.yml. The mention file looks like this:

mentions:
- source: http://waterpigs.co.uk/notes/4UAVp/
  target: http://aaronparecki.com/notes/2014/01/19/1/indieweb-micropub
  date_received: "2014-01-20 00:29:56"
  type: reply

Then when I need to go actually render a comment, I get the post data from my IndieArchive data store from a file named: ./external/waterpigs.co.uk/notes/4UAVp which is the raw HTML. The microformats parser parses the page and stores the parsed JSON at ./external/waterpigs.co.uk/notes/4UAVp.json

bcomnes commented 10 years ago

Thanks @aaronpk for that insight!