Astro implementation of openring npmjs.com/package/@jasikpark/astro-openring
astro webring typescript

Add README

caleb.jasik.xyz 928b9b6f 396dd14c

verified
+15 -31
+15 -31
README.md
··· 1 - # Astro Starter Kit: Component Package 2 - 3 - This is a template for an Astro component library. Use this template for writing components to use in multiple projects or publish to NPM. 1 + # Openring Loader 4 2 5 - ```sh 6 - pnpm create astro@latest -- --template component 7 - ``` 3 + A custom Astro content loader that combines multiple RSS/Atom feeds into a single collection. Mimics the behavior of [openring](https://git.sr.ht/~sircmpwn/openring) / [openring-rs](https://github.com/lukehsiao/openring-rs), a tool for generating webrings from RSS feeds. 8 4 9 - [![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/withastro/astro/tree/latest/examples/non-html-pages) 10 - [![Open with CodeSandbox](https://assets.codesandbox.io/github/button-edit-lime.svg)](https://codesandbox.io/p/sandbox/github/withastro/astro/tree/latest/examples/non-html-pages) 11 - [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/withastro/astro?devcontainer_path=.devcontainer/component/devcontainer.json) 5 + ## Example Usage 12 6 13 - ## ๐Ÿš€ Project Structure 14 - 15 - Inside of your Astro project, you'll see the following folders and files: 16 - 17 - ```text 18 - / 19 - โ”œโ”€โ”€ index.ts 20 - โ”œโ”€โ”€ src 21 - โ”‚ โ””โ”€โ”€ MyComponent.astro 22 - โ”œโ”€โ”€ tsconfig.json 23 - โ”œโ”€โ”€ package.json 7 + ```astro 8 + const openringCollection = defineCollection({ 9 + loader: openringLoader({ 10 + feeds: [ 11 + "https://tangled.org/calebjasik.jasik.xyz/astro-openring/feed.atom", 12 + "https://jasik.xyz/rss.xml", 13 + ], 14 + skipURLs: ["https://example.com/blog-post-with-weird-rss-feed-item"], 15 + numArticles: 50, // Total number of articles to fetch 16 + perSource: 5, // Number of articles to get from each feed 17 + }), 18 + }); 24 19 ``` 25 - 26 - The `index.ts` file is the "entry point" for your package. Export your components in `index.ts` to make them importable from your package. 27 - 28 - ## ๐Ÿงž Commands 29 - 30 - All commands are run from the root of the project, from a terminal: 31 - 32 - | Command | Action | 33 - | :------------ | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | 34 - | `pnpm link` | Registers this package locally. Run `pnpm link my-component-library` in an Astro project to install your components | 35 - | `pnpm publish` | [Publishes](https://docs.npmjs.com/creating-and-publishing-unscoped-public-packages#publishing-unscoped-public-packages) this package to NPM. Requires you to be [logged in](https://docs.npmjs.com/cli/v8/commands/pnpm-adduser) |