astro-qiita-loader

0.0.1 • Public • Published

日本語版はこちら

Astro Qiita Loader

This package provides a Qiita loader for Astro, allowing you to use Qiita posts as content collections.

Requirements

This package requires Astro 5.0.0 or later.

Installation

npm install astro-qiita-loader

Usage

You can use the qiitaLoader in your content configuration at src/content/config.ts:

import { qiitaLoader } from "astro-qiita-loader";

export const collections = {
  qiitas: qiitaLoader({
    url: "https://qiita.com/api/v2/items",
    authToken: "your_qiita_api_token", // Optional
  }),
};

You can then use these like any other content collection in Astro:

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

const qiitas = await getCollection("qiitas");
---

<ul>
  {qiitas.map((qiita) => (
    <li>
      <a href={qiita.data.url} target="_blank" rel="noopener">
        {qiita.data.title}
      </a>
    </li>
  ))}
</ul>

Options

qiitaLoader has the following options:

  • url: Qiita API URL. Set the URL of the posts you want to fetch.
  • authToken: Qiita API authentication token. Optional: 1000 req/hr with token, 60 req/hr without

Sample

See the sample for reference.

License

MIT

Package Sidebar

Install

npm i astro-qiita-loader

Weekly Downloads

2

Version

0.0.1

License

MIT

Unpacked Size

6.98 kB

Total Files

6

Last publish

Collaborators

  • t0yohei