-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add detailed documentation and license for astro-ghostcms-loade…
…r package
- Loading branch information
1 parent
cb5580e
commit 8dbd17a
Showing
3 changed files
with
77 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"cSpell.words": ["codeinjection", "ghostcms", "inox", "Matthiesen", "withastro"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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! ❤️ |