Improving Bluesky Syndication

Notes as a second source, OG images compressed with Sharp below the blob limit, publish dates as timestamps and Bluesky URLs in a committed state file.

The first version of my Bluesky syndication script posted articles and nothing else. The first real backfill showed four gaps. Notes were not syndicated at all. Large OG images went over Bluesky's blob limit. Articles from the same day collapsed into one visible post. And the state file knew that something had been posted, but not where.

The setup

  • Site: an Astro 6 static build with one RSS feed per content type (articles.xml, notes.xml and so on).
  • Deploy: a shell script that builds, syncs to the VPS and then runs bluesky-syndicate.mjs against the live feeds.
  • State: a JSON file in the repository root, committed after each run.

Several feeds as sources

Notes had their own feed from the start, but nothing read it. I replaced the hard-coded feed URL with a SOURCES array that pairs each feed with a function for the post text:

const SOURCES = [
    {
        rssUrl: 'https://adrian-altner.de/rss/articles.xml',
        label: 'article',
        postText: (item) => item.title,
    },
    {
        rssUrl: 'https://adrian-altner.de/rss/notes.xml',
        label: 'note',
        postText: (item) => item.description || item.title,
    },
];

Articles go out with their title. Notes have no title that stands on its own, so their description becomes the post body. A new content type is one more object in the array.

The state file: from array to map

The flat array of GUIDs was enough to skip duplicates, but it could not link to the copy on Bluesky:

["https://adrian-altner.de/articles/...", "..."]

Now it maps each GUID to its Bluesky post URL:

{
    "https://adrian-altner.de/articles/2026/03/23/joining-the-indieweb/": "https://bsky.app/profile/adrian-altner.de/post/3mhqb4t6ceu2w"
}

After a post the script takes the record key (rkey) from the AT Protocol URI and builds the public URL:

const { uri } = await postRes.json();
const rkey = uri.split('/').pop();
posted[item.guid] = `https://bsky.app/profile/${IDENTIFIER}/post/${rkey}`;

The rest of the build can now read the URL. That is what the u-syndication links on each article and note page use, see Syndication Links from State.

Compressing images with Sharp

Bluesky accepts blobs up to 976 KB. The OG image of a photo-heavy note came in at 1.56 MB, and the upload failed with BlobTooLarge. The script now compresses before uploading:

import sharp from 'sharp';

const compressed = await sharp(Buffer.from(rawBuffer))
    .resize(1200, 630, { fit: 'cover', position: 'centre' })
    .jpeg({ quality: 80 })
    .toBuffer();

1200 × 630 is the usual OG size. JPEG at quality 80 landed under 200 KB every time, with no visible loss at Bluesky's display size.

Publish dates instead of deploy dates

The first version stamped every post with new Date().toISOString(), so a batch of articles from different weeks all appeared as posted today. The script now reads pubDate from the RSS item and adds an offset per item:

const baseDate = item.pubDate ? new Date(item.pubDate) : new Date();
const createdAt = new Date(baseDate.getTime() + i * 1000).toISOString();

The + i * 1000 matters. When I posted with identical createdAt values, the posts disappeared and only one showed up. One second per index keeps them apart and the date stays right.

Committing the state after each run

The deploy script checks whether the state file changed and commits it:

if ! git diff --quiet .bluesky-posted.json; then
  git add .bluesky-posted.json
  git commit -m "chore: update bluesky posted state"
  git push
fi

Without this step the file resets on the next checkout, and the following deploy posts every article again.

Takeaways

  • A feed per content type plus a small SOURCES array makes a new type a one-line change.
  • A state file is worth more when it stores the remote URL, not just the GUID.
  • 1200 × 630 at JPEG quality 80 fits Bluesky's blob limit reliably.

More on this

Topic
  • IndieWeb Publishing on your own domain first and connecting personal websites with open standards such as Webmention and Microformats.
Basis for
  • Syndication Links from State Astro imports the syndication state file at build time and renders u-syndication links on every post, so the frontmatter never needs a second edit.
Builds on
  • POSSE to Bluesky with the AT Protocol A Node script at the end of every deploy that posts new articles from the RSS feed to Bluesky as rich link cards, straight through the AT Protocol API.
Uses
  • Astro Tool for building websites from content such as Markdown. Ships plain HTML by default and only loads JavaScript where it is needed.

Show in the graph view →