Skip to content

Hive Astro Loader

Hive Astro Loader

Hive Astro Loader is a custom Astro loader for the Content Layer API that allows to fetch content from Hive blockchain.

Astro is the web framework for building content-driven websites like blogs, marketing, and e-commerce. Astro is best-known for pioneering a new frontend architecture to reduce JavaScript overhead and complexity compared to other frameworks. If you need a website that loads fast and has great SEO, then Astro is for you.

The Content Layer API is a new feature of Astro that allows you to fetch content for the app from any source, be it Markdown files, JSON, database, API or anything else.

Utilizing the Content Layer API, we can build a custom Astro loader that makes it very easy to fetch and present content published on the Hive blockchain.

If you want to learn more about Astro, Content Layer API, or any of the other features of Astro, check out the links below:

Astro Content Layer loader for the Hive blockchain

Terminal window
npm install @onhive.io/astro-loader

or use our favorite package manager.

Hive Blog Loader

In your Astro project, edit the /src/content/config.ts:

import { defineCollection } from "astro:content";
import { hiveBlogLoader, hiveAccountsLoader } from "@onhive.io/astro-loader";
export const collections = {
blog: defineCollection({
type: "content_layer",
loader: hiveBlogLoader("hive.coding") // Selected username
}),
accounts: defineCollection({
type: "content_layer",
loader: hiveAccountsLoader("hive.coding") // or ["acc1", "acc2"] for multiple accounts
})
};

To learn about the full functionality of this package, please head out to our GitHub page.