This commit is contained in:
Adam Matthiesen 2024-01-23 20:28:48 -08:00
parent da7bb6734e
commit c6b18e5bba
3 changed files with 30 additions and 3 deletions

View File

@ -4,7 +4,7 @@ description: Learn more about Astro-GhostCMS - Docs built on Starlight
---
Demo site status:
![Vercel](https://vercelbadge.vercel.app/api/matthiesenxyz/astro-ghostcms-demo)
![Vercel](https://vercelbadge.vercel.app/api/matthiesenxyz/astro-ghostcms)
Welcome to the Astro-GhostCMS Docs! Powered by Starlight & Astro.build!

View File

@ -5,4 +5,31 @@ description: API Only Mode - Basic Usage
## 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>
))
}
```

View File

@ -6,7 +6,7 @@ description: Getting Started
- [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) for an example of how the setup looks.
Astro minimum Version: **Astro v4.0**