Skip to content

Commit

Permalink
feat: add detailed documentation and license for astro-ghostcms-loade…
Browse files Browse the repository at this point in the history
…r package
  • Loading branch information
Adammatthiesen committed Jan 8, 2025
1 parent cb5580e commit 8dbd17a
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"cSpell.words": ["codeinjection", "ghostcms", "inox", "Matthiesen", "withastro"]
}
22 changes: 22 additions & 0 deletions package/LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

The MIT License (MIT)

Copyright (c) 2025 Adam Matthiesen

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
52 changes: 52 additions & 0 deletions package/README.md
Original file line number Diff line number Diff line change
@@ -1 +1,53 @@
# astro-ghostcms-loader

This package provides a GhostCMS loader for astro. Allowing ease of use of all your GhostCMS content within astro's built in Content Layer!

## Installation

```sh
npm install astro-ghostcms-loader
```

## Usage

To use this loader, it is required that you be on at least Astro `v5.0.0`

Also make sure to create and set your `.env` file with the following:

```.env
GHOST_CONTENT_API_KEY=your_api_key_here
```

In `src/content.config.ts`, import and configure the loaderCollection:

```ts
import { GhostCMSLoaderCollection} from 'astro-ghostcms-loader';

export const collections = {
...GhostCMSLoaderCollection({
ghostUrl: 'https://demo.ghost.io' // Your GhostCMS Instance URL
apiVersion?: 'v5.0' // OPTIONAL - Allows you to define a specific version (min: v5.0)
}),
}
```

[Query the content collection](https://docs.astro.build/en/guides/content-collections/#querying-collections) like any other Astro content collection entry:

```ts
import { getCollection } from "astro:content"

const pages = await getCollection("ghostPages"); // Supports the render() function from astro
const posts = await getCollection("ghostPosts"); // Supports the render() function from astro
const tags = await getCollection("ghostTags");
const authors = await getCollection("ghostAuthors");
const tiers = await getCollection("ghostTiers");
const settings = await getEntry('ghostSettings', 'settings');
```

## Changelog

See the [Changelog](./CHANGELOG.md) for the change history of this loader.

## Contribution

If you see any errors or room for improvement, feel free to open an [issues or pull request](https://github.com/MatthiesenXYZ/ghostcms-loader/) . Thank you in advance for contributing! ❤️

0 comments on commit 8dbd17a

Please sign in to comment.