This commit is contained in:
parent
da7bb6734e
commit
c6b18e5bba
|
@ -4,7 +4,7 @@ description: Learn more about Astro-GhostCMS - Docs built on Starlight
|
||||||
---
|
---
|
||||||
|
|
||||||
Demo site status:
|
Demo site status:
|
||||||

|

|
||||||
|
|
||||||
Welcome to the Astro-GhostCMS Docs! Powered by Starlight & Astro.build!
|
Welcome to the Astro-GhostCMS Docs! Powered by Starlight & Astro.build!
|
||||||
|
|
||||||
|
|
|
@ -5,4 +5,31 @@ description: API Only Mode - Basic Usage
|
||||||
|
|
||||||
## Manual Function Usage Examples:
|
## Manual Function Usage Examples:
|
||||||
|
|
||||||
New examples coming soon...
|
### getBlogPosts
|
||||||
|
|
||||||
|
```astro frame="code" title="getBlogPosts()"
|
||||||
|
---
|
||||||
|
import { getPosts } from '@matthiesenxyz/astro-ghostcms/api';
|
||||||
|
|
||||||
|
const dateOptions = {year:"numeric",month:"long",day:"numeric"}
|
||||||
|
const posts = await getPosts()
|
||||||
|
---
|
||||||
|
{ posts?.map((post) => (
|
||||||
|
<a href={`/${post.slug}`}>
|
||||||
|
<article class="">
|
||||||
|
<Image
|
||||||
|
src={post.feature_image}
|
||||||
|
alt={post.title}
|
||||||
|
width={post.feature_image.width}
|
||||||
|
class=""/>
|
||||||
|
<h2 class="">{post.title}</h2>
|
||||||
|
|
||||||
|
<p class="">{post.excerpt}</p>
|
||||||
|
<p class="">
|
||||||
|
{new Date(post.published_at).toLocaleDateString( "en-US",dateOptions )}
|
||||||
|
</p>
|
||||||
|
</article>
|
||||||
|
</a>
|
||||||
|
))
|
||||||
|
}
|
||||||
|
```
|
|
@ -6,7 +6,7 @@ description: Getting Started
|
||||||
|
|
||||||
- [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 - 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) for an example of how the setup looks.
|
||||||
|
|
||||||
Astro minimum Version: **Astro v4.0**
|
Astro minimum Version: **Astro v4.0**
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue