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

@nonsponsored/storyblok-loader

v1.0.3

Published

Storyblok loader for Astro Content Collections API

Readme

@nonsponsored/storyblok-loader

A content loader for Astro Content Layer that fetches content from Storyblok's API.

Requirements

  • Astro 5.2.0 or higher (required for Content Layer API)
  • @storyblok/astro 6.0.0 or higher

Important Notes

  • Intended to be used for build process, not in development mode or using Storyblok's Live Preview.
  • Internationalization support has not been tested. Use with caution and please report any issues you encounter.

Installation

Using npm:

npm install @nonsponsored/storyblok-loader

Using yarn:

yarn add @nonsponsored/storyblok-loader

Usage

  1. Set up your environment variables in .env:
  • STORYBLOK_API_KEY: Your Storyblok API token
  • STORYBLOK_API_VERSION: "draft" or "published"

Note: In production, the loader will always use the "published" version regardless of the STORYBLOK_API_VERSION setting.

  1. Configure your content collection in src/content/config.ts:
import { defineCollection } from "astro:content";
import { storyblokLoader } from "@nonsponsored/storyblok-loader";

const storyblokCollection = defineCollection({
    loader: storyblokLoader({
        accessToken: import.meta.env.STORYBLOK_API_KEY,
        version: import.meta.env.MODE === "production" ? "published" : import.meta.env.STORYBLOK_API_VERSION,
        region: "us",
        language: "en",
        contentType: "blog",
        resolve_relations: ["author.posts", "related_posts"],
        resolve_links: "url",
        sort_by: "content.published_date:desc",
        filter_query: {
            "content.category": "technology"
        }
    })
});

export const collections = {
    storyblok: storyblokCollection,
};

Configuration Options

The loader accepts the following options:

| Option | Type | Default | Description | |--------|------|---------|-------------| | accessToken | string | Required | Your Storyblok API token | | version | "published" | "draft" | "published" | Content version to fetch | | region | "us" | "eu" | "us" | Storyblok API region | | language | string | undefined | Language/locale code (e.g., "en", "de") | | contentType | string | undefined | Filter by content type | | sort_by | string | undefined | Sort entries by field | | filter_query | Record<string, any> | undefined | Filter by field values | | resolve_relations | string[] | undefined | Resolve relationships | | resolve_links | "url" | "story" | "0" | "1" | "2" | undefined | Resolve links to other stories |

Returned Data Structure

The loader returns an array of stories with the following structure:

interface Story {
    id: string;
    slug: string;
    content: unknown;
    name: string;
    created_at: string;
    published_at: string;
    editable?: string;
    is_folder?: boolean;
    full_slug: string;
    language?: string;
    translated_slugs?: Array<{
        lang: string;
        name: string;
        path: string;
    }>;
}

Examples

Basic Usage

const storyblokCollection = defineCollection({
    loader: storyblokLoader({
        accessToken: import.meta.env.STORYBLOK_API_KEY,
        version: import.meta.env.MODE === "production" ? "published" : "draft",
        region: "us"
    })
});

export const collections = {
    storyblok: storyblokCollection,
};

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

MIT License