npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

astro-loader-bluesky-posts

v1.2.3

Published

Astro loader for loading Bluesky posts and threads using post URLs or AT-URIs.

Readme

astro-loader-bluesky-posts

version jsDocs.io npm downloads demo

This package provides a Bluesky posts loader for Astro, supporting both post URLs and AT-URIs to fetch posts for use in Astro projects. Features include customizable HTML rendering, optional threaded loading, and targeted fetching of author-specific replies.

Installation

npm install -D astro-loader-bluesky-posts

Usage

To use the Astro loader, ensure Astro version ^4.14.0 || ^5.0.0. For ^4.14.0, enable the experimental content layer in astro.config.ts:

export default defineConfig({
  experimental: {
    contentLayer: true,
  },
})

In src/content/config.ts (for ^4.14.0) or src/content.config.ts (for ^5.0.0), import and configure the loader to define a new content collection:

import { defineCollection } from "astro:content"
import { BlueskyPostsLoader } from "astro-loader-bluesky-posts"

const posts = defineCollection({
  loader: BlueskyPostsLoader({
    uris: [
      'https://bsky.app/profile/bsky.app/post/3l6oveex3ii2l'
      // 'https://bsky.app/profile/did:plc:z72i7hdynmk6r22z27h6tvur/post/3l6oveex3ii2l'
      // 'at://bsky.app/app.bsky.feed.post/3l6oveex3ii2l'
      // 'at://did:plc:z72i7hdynmk6r22z27h6tvur/app.bsky.feed.post/3l6oveex3ii2l'
    ],
    // Check the configuration below
  }),
})

export const collections = { posts }

Query the content collection like any other Astro content collection to render the loaded posts:

---
import { getCollection } from "astro:content"

const posts = await getCollection("posts")
// Check the entries' Zod schema for available fields below
---

{
  posts.map(async (post) => {
    const { Content } = await render(post)
    return (
      <section>
        <Content />
        <p>{post.data.indexedAt}</p>
      </section>
    )
  })
}

To update the data, trigger a site rebuild, as the loader fetches data only at build time.

Configuration

This loader retrieves posts via the Bluesky API GET /xrpc/app.bsky.feed.getPosts and GET /xrpc/app.bsky.feed.getPostThread. Options include:

| Option (* required) | Type (default) | Description | | ------------------------ | ----------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | uris* | string[] | List of Bluesky post URLs or AT-URIs. | | linkTextType | 'domain-path' \| 'post-text' (default: 'post-text') | The type of text to display for links when generating renderable HTML:'domain-path': Displays the link's domain and path.'post-text': Uses the link text as shown in the tweet. | | newlineHandling | 'none' \| 'break' \| 'paragraph' (default: 'none') | The way for processing \n when generating renderable HTML:'none': Keep as is.'break': Replace consecutive \n with <br>.'paragraph': Wrap paragraphs with <p> while removing standalone \n. | | fetchThread | boolean (default: false) | Whether to fetch the post's thread including replies and parents. | | threadDepth | number (default: 1) | The depth of the descendant post tree to fetch if fetching the thread. Specifies how many levels of reply depth should be included. | | threadParentHeight | number (default: 1) | The height of the ancestor post tree to fetch if fetching the thread. Specifies how many levels of parent posts should be included. | | fetchOnlyAuthorReplies | boolean (default: false) | Whether to fetch only the post author's replies at the specified threadDepth. When true, it returns only the author's replies as a flat array, ignoring threadParentHeight and parent. |

Schema

See the source code for the Zod schema of loaded entries. Astro automatically applies this schema to generate TypeScript interfaces, enabling autocompletion and type-checking for collection queries.

To customize the schema, ensure compatibility with the loader's built-in Zod schema to prevent errors. For additional fields, consider opening an issue.

Changelog

See CHANGELOG.md for the change history of this loader.

Contribution

If you see any errors or room for improvement, feel free to open an issues or pull request . Thank you in advance for contributing! ❤️