Merge branch 'main' of https://github.com/MatthiesenXYZ/astro-ghostcms
This commit is contained in:
commit
6585fcebb8
133
README.md
133
README.md
|
@ -1,6 +1,7 @@
|
||||||
# Welcome to Astro-GhostCMS
|
# Welcome to Astro-GhostCMS
|
||||||
|
|
||||||
- [Live Demo](https://demo.astro-ghostcms.xyz/) of the Astro-GhostCMS integration in action!
|
- [Live Demo](https://demo.astro-ghostcms.xyz/) of the Astro-GhostCMS integration in action!
|
||||||
|
- [Live Demo - Unlighthouse Test](https://test.demo.astro-ghostcms.xyz) for a Automatically updated Lighthouse test from every deploy!
|
||||||
- [Live Demo's Repo](https://github.com/MatthiesenXYZ/astro-ghostcms-demo) for an example of how the setup looks.
|
- [Live Demo's Repo](https://github.com/MatthiesenXYZ/astro-ghostcms-demo) for an example of how the setup looks.
|
||||||
|
|
||||||
Astro minimum Version: **Astro v4.0**
|
Astro minimum Version: **Astro v4.0**
|
||||||
|
@ -95,134 +96,4 @@ CONTENT_API_URL=https://ghostdemo.matthiesen.xyz
|
||||||
|
|
||||||
**When you deploy your install dont forget to set the above ENVIRONMENT VARIABLES!**
|
**When you deploy your install dont forget to set the above ENVIRONMENT VARIABLES!**
|
||||||
|
|
||||||
## Manual Function Usage Examples:
|
For more information please check our website: [Astro-GhostCMS.xyz](https://astro-ghostcms.xyz)
|
||||||
|
|
||||||
### getGhostPosts() - Get list of posts
|
|
||||||
|
|
||||||
```astro
|
|
||||||
---
|
|
||||||
// IMPORT {GET} GhostPosts Function
|
|
||||||
import { getGhostPosts } from '@matthiesenxyz/astro-ghostcms/api';
|
|
||||||
// GET LIST OF ALL POSTS
|
|
||||||
const ghostPosts = await getGhostPosts();
|
|
||||||
---
|
|
||||||
```
|
|
||||||
|
|
||||||
### getGhostRecentPosts(setLimit?) - Get Recent Posts (setLimit={6})
|
|
||||||
|
|
||||||
```astro
|
|
||||||
---
|
|
||||||
// IMPORT {GET} GhostFeaturedPosts Function
|
|
||||||
import { getGhostRecentPosts } from "@matthiesenxyz/astro-ghostcms/api";
|
|
||||||
// CREATE INTERFACE TO PASS 'setLimit' for POST LIMIT
|
|
||||||
interface Props {
|
|
||||||
setLimit?:number;
|
|
||||||
}
|
|
||||||
// IF 'setLimit' IS NOT DEFINED AS PROP THEN MAKE IT DEFAULT TO 'undefined'
|
|
||||||
const { setLimit = undefined } = Astro.props
|
|
||||||
// GET POSTS with Limit
|
|
||||||
const ghostPosts = await getGhostRecentPosts(setLimit);
|
|
||||||
---
|
|
||||||
```
|
|
||||||
|
|
||||||
### getGhostFeaturedPosts(setLimit?) - Get Featured Posts (setLimit={1})
|
|
||||||
|
|
||||||
```astro
|
|
||||||
---
|
|
||||||
// IMPORT {GET} GhostFeaturedPosts Function
|
|
||||||
import { getGhostFeaturedPosts } from "@matthiesenxyz/astro-ghostcms/api";
|
|
||||||
// CREATE INTERFACE TO PASS 'setLimit' for POST LIMIT
|
|
||||||
interface Props {
|
|
||||||
setLimit?:number;
|
|
||||||
}
|
|
||||||
// IF 'setLimit' IS NOT DEFINED AS PROP THEN MAKE IT DEFAULT TO 'undefined'
|
|
||||||
const { setLimit = undefined } = Astro.props
|
|
||||||
// GET POSTS with Limit
|
|
||||||
const ghostPosts = await getGhostFeaturedPosts(setLimit);
|
|
||||||
---
|
|
||||||
```
|
|
||||||
|
|
||||||
### getGhostPostbySlug(slug) - Get Post by Slug
|
|
||||||
|
|
||||||
```astro
|
|
||||||
---
|
|
||||||
// IMPORT {GET} GhostPostbySlug Function
|
|
||||||
import { getGhostPostbySlug } from '@matthiesenxyz/astro-ghostcms/api';
|
|
||||||
// GET SLUG from /blog/[slug]
|
|
||||||
const { slug } = Astro.params;
|
|
||||||
// GET CURRENT POST BY PASSING SLUG TO FUNCTION
|
|
||||||
const ghostPost = await getGhostPostbySlug(slug);
|
|
||||||
---
|
|
||||||
```
|
|
||||||
|
|
||||||
### getGhostPostsbyTag(slug) - Get Posts list by Tag slug
|
|
||||||
|
|
||||||
```astro
|
|
||||||
---
|
|
||||||
// IMPORT {GET} GhostPostsbyTag, and GhostTagbySlug Functions
|
|
||||||
import { getGhostPostsbyTag, getGhostTagbySlug } from '@matthiesenxyz/astro-ghostcms/api';
|
|
||||||
// GET SLUG from /blog/tag/[slug]
|
|
||||||
const { slug } = Astro.params;
|
|
||||||
// GET TAG BY SLUG TO DISPLAY TAG INFO
|
|
||||||
const ghostTag = await getGhostTagbySlug(slug);
|
|
||||||
// GET POSTS FILTERED BY TAG SLUG
|
|
||||||
const ghostPosts = await getGhostPostsbyTag(slug)
|
|
||||||
---
|
|
||||||
```
|
|
||||||
|
|
||||||
### getGhostTags() - Get list of tags
|
|
||||||
|
|
||||||
```astro
|
|
||||||
---
|
|
||||||
// IMPORT {GET} GhostTags Function
|
|
||||||
import { getGhostTags } from "@matthiesenxyz/astro-ghostcms/api";
|
|
||||||
// GET LIST OF ALL TAGS
|
|
||||||
const ghostTags = await getGhostTags();
|
|
||||||
---
|
|
||||||
```
|
|
||||||
|
|
||||||
### getGhostAuthors() - Get list of Authors
|
|
||||||
|
|
||||||
```astro
|
|
||||||
---
|
|
||||||
// IMPORT {GET} GhostAuthors Function
|
|
||||||
import { getGhostAuthors } from "@matthiesenxyz/astro-ghostcms/api";
|
|
||||||
// GET LIST OF ALL AUTHORS
|
|
||||||
const ghostAuthors = await getGhostAuthors();
|
|
||||||
---
|
|
||||||
```
|
|
||||||
|
|
||||||
### getGhostPages() - Get list of Pages
|
|
||||||
|
|
||||||
```astro
|
|
||||||
---
|
|
||||||
// IMPORT {GET} GhostAuthors Function
|
|
||||||
import { getGhostPages } from "@matthiesenxyz/astro-ghostcms/api";
|
|
||||||
// GET LIST OF ALL AUTHORS
|
|
||||||
const ghostPages = await getGhostPages();
|
|
||||||
---
|
|
||||||
```
|
|
||||||
|
|
||||||
### getGhostPage(slug) - Get page by slug
|
|
||||||
|
|
||||||
```astro
|
|
||||||
---
|
|
||||||
// IMPORT {GET} GhostPostbySlug Function
|
|
||||||
import { getGhostPage } from '@matthiesenxyz/astro-ghostcms/api';
|
|
||||||
// GET SLUG from /blog/[slug]
|
|
||||||
const { slug } = Astro.params;
|
|
||||||
// GET CURRENT POST BY PASSING SLUG TO FUNCTION
|
|
||||||
const ghostpage = await getGhostPage(slug);
|
|
||||||
---
|
|
||||||
```
|
|
||||||
|
|
||||||
### getGhostSettings() - Get Settings for GhostCMS
|
|
||||||
|
|
||||||
```astro
|
|
||||||
---
|
|
||||||
// IMPORT {GET} GhostAuthors Function
|
|
||||||
import { getGhostSettings } from "@matthiesenxyz/astro-ghostcms/api";
|
|
||||||
// GET LIST OF ALL AUTHORS
|
|
||||||
const ghostSettings = await getGhostSettings();
|
|
||||||
---
|
|
||||||
```
|
|
||||||
|
|
Loading…
Reference in New Issue