diff --git a/config/collections/index.js b/config/collections/index.js index aa327c9..63de72c 100644 --- a/config/collections/index.js +++ b/config/collections/index.js @@ -1,5 +1,7 @@ const tags = require('./tags'); +const posts = require('./posts'); module.exports = function(eleventyConfig) { eleventyConfig.addPlugin(tags); + eleventyConfig.addPlugin(posts); } \ No newline at end of file diff --git a/config/collections/posts.js b/config/collections/posts.js new file mode 100644 index 0000000..1d9e774 --- /dev/null +++ b/config/collections/posts.js @@ -0,0 +1,7 @@ +module.exports = function (eleventyConfig) { + eleventyConfig.addCollection('posts',collectionApi => + collectionApi.getFilteredByTag("posts") + .filter(p => process.env.DEBUG || !p.data.tags.includes("draft")) + .filter(p => process.env.DEBUG || p.date < new Date()) + ) +} \ No newline at end of file diff --git a/src/_includes/post.njk b/src/_includes/post.njk index c0eaaf2..382757e 100644 --- a/src/_includes/post.njk +++ b/src/_includes/post.njk @@ -9,7 +9,7 @@ includePrism: true
{{ content | safe }}
- {% set filteredTags = tags | except("posts") %} + {% set filteredTags = tags | except("posts") | except("draft") %} {% if filteredTags | length %}

Tags:

diff --git a/src/blog/posts/2024/1/archiving-firefish-posts.md b/src/blog/posts/2024/1/archiving-firefish-posts.md new file mode 100644 index 0000000..81b4cad --- /dev/null +++ b/src/blog/posts/2024/1/archiving-firefish-posts.md @@ -0,0 +1,30 @@ +--- +title: "New project: archive your Firefish posts" +tags: + - draft +--- + +This project is heavily inspired by Zach Leatherman's [Tweetback](https://www.zachleat.com/web/tweetback/)], but instead of being for Twitter, it's for Firefish. I recently [moved away from using Firefish](/post/simplifying-things-for-2024), but I didn't want to remove the instance as then the individual posts would be inaccessible. While I don't think anything I wrote on that account is particularly impactful (unless someone's been cataloguing my commutes or something), I'd still like to make them accessible for posterity. + +## My solution + +So I built this tool: [Firefish Archiver](https://git.lewisdale.dev/lewis/firefish-archive). It uses Eleventy + the open Firefish API to retrieve every public note from the account, and then recreate it using the same URL structure. I've (tried) to make the resulting HTML as un-shit as possible, but it's still very much a work-in-progress. + +Usage is pretty simple: add your user ID and Firefish host to the `src/_data/metadata.json` file, and then run the `npm build` command. The template then: + +1. Fetches your profile information and recreates it +2. Fetches all of the public posts and organises them into threads +3. Creates a `/.well-known/webfinger` file pointing to whatever account you've redirected to + +Then, you can upload the output in the `_site` directory to any location you'd like. The output is cached, so you shouldn't need to worry about the instance being deleted on subsequent rebuilds. The _intention_ for this is that it can replace the instance entirely as a static drop-in, for single-user instances, but it can also be used if you want to host a copy of the content from another instance. + +## Things still to add + +I've got plans to add a few extra details. Namely: + +1. Content warnings +2. Favourite & Renote counts +3. Site search +4. Improving the styling + +Feedback on the project is always appreciated - you can send a webmention to this page, or drop me a message through any of [my socials][/links]. \ No newline at end of file