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-zenn-loader

v1.0.1

Published

Astro Content Collections用のZenn RSSローダーです。Zennの記事をAstroのコンテンツコレクションとして簡単に取得・管理できます。

Downloads

100

Readme

astro-zenn-loader

Astro Content Collections用のZenn RSSローダーです。Zennの記事をAstroのコンテンツコレクションとして簡単に取得・管理できます。

特徴

  • 🚀 簡単な設定 - わずか数行のコードでZennの記事を取得
  • 📝 型安全 - Zodスキーマによる完全な型サポート
  • 🔄 自動同期 - RSSフィードから最新の記事を自動取得
  • 高速 - Astro Content Layer APIを活用した効率的なデータ取得
  • 🛠️ エラーハンドリング - 堅牢なエラー処理とログ出力

インストール

npm install astro-zenn-loader

または

yarn add astro-zenn-loader

または

pnpm add astro-zenn-loader

基本的な使い方

1. コンテンツコレクションの設定

src/content.config.tsファイルを作成し、Zennローダーを設定します:

import { defineCollection } from 'astro:content';
import { zennLoader } from 'astro-zenn-loader';

const zennArticles = defineCollection({
  loader: zennLoader({
    name: 'your-zenn-username', // あなたのZennユーザー名
  }),
});

export const collections = {
  zennArticles,
};

2. Astroページでの使用

---
// src/pages/articles.astro
import { getCollection } from 'astro:content';

const articles = await getCollection('zennArticles');
---

<html>
  <head>
    <title>Zenn Articles</title>
  </head>
  <body>
    <h1>My Zenn Articles</h1>
    <ul>
      {articles.map((article) => (
        <li>
          <a href={article.data.link}>
            <h2>{article.data.title}</h2>
            <p>{article.data.contentSnippet}</p>
            <time>{new Date(article.data.pubDate).toLocaleDateString()}</time>
          </a>
        </li>
      ))}
    </ul>
  </body>
</html>

詳細な使用例

記事の詳細ページ

個別の記事詳細を表示する場合:

---
// src/pages/article/[id].astro
import { getCollection, getEntry } from 'astro:content';

export async function getStaticPaths() {
  const articles = await getCollection('zennArticles');
  return articles.map((article) => ({
    params: { id: article.id },
  }));
}

const { id } = Astro.params;
const article = await getEntry('zennArticles', id);
---

<html>
  <head>
    <title>{article.data.title}</title>
  </head>
  <body>
    <article>
      <h1>{article.data.title}</h1>
      <p>著者: {article.data.creator}</p>
      <time>公開日: {new Date(article.data.pubDate).toLocaleDateString()}</time>

      <div set:html={article.data.content} />

      <a href={article.data.link}>Zennで読む →</a>
    </article>
  </body>
</html>

APIリファレンス

zennLoader(options)

Zenn RSSローダーを作成します。

パラメータ

  • options.name (string, required): ZennのユーザーID

返り値

Astro Content Collections用のローダーオブジェクト

データスキーマ

各記事エントリーは以下の型を持ちます:

interface ZennItem {
  creator: string;          // 著者名
  title: string;            // 記事タイトル
  link: string;             // 記事URL
  pubDate: string;          // 公開日
  enclosure: {              // OGP画像情報
    url: string;
    length: string | number;
    type: string;
  };
  "dc:creator": string;     // 著者名
  content: string;          // 記事本文(HTML)
  contentSnippet: string;   // 記事の要約
  guid: string;             // 一意のID
  isoDate: string;          // ISO 8601形式の日付
}

ライセンス

MIT

コントリビューション

プルリクエストを歓迎します!バグ報告や機能リクエストはIssuesでお知らせください。

作者

@staticWagomU

関連リンク