From IndieWeb
Jump to: navigation, search



pзk (pronounced "peek") is the name of the software that runs aaronparecki.com and indiewebcat.com.

Source Code

While the entirety of p3k is not open source, I have open-sourced many of the components. I've chosen to provide components of my site rather than the whole thing because in reality nobody is going to want to use the exact same workflow I have built. Instead, components of my site can be re-used by others in their own way.




p3k has a built-in authorization endpoint, which supports customizing the scope granted, as well as restricting which "channels" apps can post to.



Folder Structure

All content in p3k is stored as files on disk.

There is a main folder "posts" which contains individual files for each post as well as any associated files. Posts are stored in a folder structure by year/month/day/index.


The index increments with each new post created on that day. The index is not necessarily time-ordered, since quite often various import scripts create backdated posts after newer posts were already created.


Ultimately each post ends up with its own folder containing the primary post file post.txt, and optionally a public folder containing associated files. The web server serves files from this folder directly.

A post with a URL of:


will correspond with a storage file:


The image at the URL:


will be stored on disk as:


File Format

The contents of the post.txt file is described below.

There is a YAML header block which contains some top-level properties that are core to p3k, such as published, type, content-type, and client-id. These are indexed in the database and control how the post is sorted and how it is rendered.

There is another top-level property called properties which contains the Microformats2 vocabulary of all the post contents, with the exception of the content property.

The header block is delimited by --- ..., and everything below the header is considered the content Microformats2 property. The content-type property notes the content type in order to indicate which renderer to use. (Either text, in which case a basic autolinker is used, Markdown which renders the Markdown as HTML, or HTML which outputs the contents directly without any processing.)

published: "2017-04-15T18:23:00-07:00"
type: entry
content-type: text/plain
client_id: https://ownyourgram.com
  category: indieweb
    - h-card
      name: Migration Brewing Company
      latitude: 45.526300
      longitude: -122.636451
      locality: Portland
      region: Oregon
      country-name: USA
  syndication: https://www.instagram.com/p/BS7XoRCANxF/
  photo: photo.jpg
  - photos
  - primary

Scheming. #indieweb

All values can be either arrays or single values, and there is some code to abstract reading and writing the values regardless of whether they are strings or arrays.

All properties in properties can be read and written via Micropub requests.

Indexing and Caching

To render lists of posts, such as channels and tags, a database indexing strategy is used. Channels are top-level URLs such as /notes, /photos, /checkins. Tag pages live under the "tag" subdirectory, e.g. /tag/indieweb. The home page is actually just another channel named "primary".

Certain properties of each post are cached in a MySQL database and used when querying channel and tag pages.

  • the published date, stored as UTC date with separate timezone offset
  • the category property (tags)
  • the p3k-channel property

To generate a page such as the home page or a tag page, the database is queried and sorted by published date. The database returns the list of filenames, and then each post file is read from disk and rendered in a list.

Working On

The things I am currently implementing in p3k:

Error retrieving content from GitHub. Malformed JSON was returned from the API.

URL is: https://github.com/aaronpk/p3k/issues?labels=priority%3Ain-progress


These are a collection of annoyances that have respective features / improvements. As their annoyance level bubbles to the top, they're likely to become concrete "Working On" tasks.

Venues / Checkins

  • ✅ Checkin posts, e.g. https://aaronparecki.com/2017/04/19/9/
  • Venue permalinks
    • Find a good URL structure (I think I'm happy with the current solution)
    • Need to store a mapping between Foursquare venues and my own permalinks, including handling what happens when Foursquare venues are merged/deleted
    • Need a good venue search, or just defer to Foursquare checkins for now
  • Replicate Foursquare lists on my site, along with a comment about why a venue is in that list
  • Show venues clustered on a map
  • Figure out what a venue permalink shows about the venue
    • Comments from me about the venue? (e.g. foursquare tips)
    • Collections the venue appears on
    • A list of all my checkins at the venue? Last couple checkins? Paged feed of checkins?
  • How to handle private venues? (Both from PESOSing foursquare checkins of private venues, and for checking in only on my site)
  • Having real venue support would also make it easier to create events at locations, rather than just named places with no location info

Github Issues

These are taken from the Github issues "itching" label: https://github.com/aaronpk/p3k/issues

New "music" post type

... and automatically generate a png thumbnail of the song



1 comment

Need Further Thought


Since I carry an active GPS tracker at all times, I collect a large amount of location data. It currently provides data to location-tag all my posts, and sets the timezone of the posts to my local timezone. I do not have a feed of the raw location data available.

I'm considering publishing a new "location" post any time I change cities (or possibly also large neighborhood). Here is an example of publishing my city automatically to Facebook: http://www.flickr.com/photos/aaronpk/6962452588/

There are other non-venue locations I may want to publish, such as when I get into a neighborhood I haven't been to in a while. Ideally my phone would detect automatically when I've entered a new area or an area I haven't been to in a while. Probably I would want it to prompt me before publishing anything publicly. I could receive a push notification saying something like "It looks like you're in NW Portland for the first time this year! Publish this?" These posts are usually only interested when there is some additional information that provides context, such as "for the first time this year"


See Also

Retrieved from "https://indieweb.org/p3k"
Personal tools
Recent & Upcoming