astro-ghostcms/README.md

106 lines
4.4 KiB
Markdown
Raw Normal View History

2024-01-19 13:24:10 +00:00
<img src="https://ghostdemo.matthiesen.xyz/content/images/size/w50/2024/01/logo-1.png" width="64px" />
2024-01-19 13:23:21 +00:00
2024-01-13 07:20:44 +00:00
# Welcome to Astro-GhostCMS
2024-01-18 14:53:15 +00:00
- [Live Demo](https://demo.astro-ghostcms.xyz/) of the Astro-GhostCMS integration in action!
2024-01-19 04:50:27 +00:00
- [Live Demo - Unlighthouse Test](https://test.demo.astro-ghostcms.xyz) for a Automatically updated Lighthouse test from every deploy!
2024-01-17 11:22:08 +00:00
- [Live Demo's Repo](https://github.com/MatthiesenXYZ/astro-ghostcms-demo) for an example of how the setup looks.
2024-01-17 11:12:49 +00:00
2024-01-19 19:28:18 +00:00
*Need help but don't have Github? Email us at [issues@astro-ghostcms.xyz](mailto:issues@astroghostcms.xyz) to create an issue here on github!*
Astro minimum Version: **Astro v4.0**
2024-01-17 10:29:47 +00:00
This Integration is 2 parts. Firstly, there is the API portion that uses the `@tryghost/content-api` to create the link between astro and GhostCMS. From there we move to the Second Part, which is a theme pre-programmed to pull ALL of its data from GhostCMS iteself instead of storing any data locally outside of Build.
2024-01-13 07:20:44 +00:00
2024-01-17 10:18:57 +00:00
- *This package contains a independent copy of the tryghost content-api.js that is used to establish the connection so this package dose not depend on `@tryghost/content-api` package.*
- If you are looking for a more Customizable option please check [astro-ghostcms-basetheme](https://github.com/MatthiesenXYZ/astro-ghostcms-basetheme)
2024-01-17 10:29:47 +00:00
- This project is not setup for SSR in Integration mode. As such is will most likely not function properly in that mode. You will need to build your own project around the API or customize the *basetheme* linked above.
2024-01-13 07:45:04 +00:00
2024-01-17 11:19:14 +00:00
# Astro Integration Mode
In this mode, the addon will not be just an API, but will be a full Route takeover, there is plans to add more themes in time, but for now there is only the base Casper theme based on Ghost's main Theme.
2024-01-17 11:19:14 +00:00
## Astro Add Installation
2024-01-17 11:03:58 +00:00
```sh
# For fresh Install
npm create astro@latest
# Create Empty Install with standard typescript
2024-01-17 11:05:06 +00:00
# Then Delete entire `pages` folder under `/src/`
2024-01-17 11:03:58 +00:00
npx astro add @matthiesenxyz/astro-ghostcms
```
2024-01-17 11:19:14 +00:00
#### Dont forget to set your environment Variables!
2024-01-17 11:19:14 +00:00
You must also create 2 environment variables in a `.env` file with the following:
```env
CONTENT_API_KEY=a33da3965a3a9fb2c6b3f63b48
CONTENT_API_URL=https://ghostdemo.matthiesen.xyz
```
## Manual Installation
2024-01-17 10:01:04 +00:00
```
npm i @matthiesenxyz/astro-ghostcms
```
Then set your astro.config.ts to look like this:
2024-01-17 10:18:57 +00:00
```ts
2024-01-17 10:01:04 +00:00
import { defineConfig } from "astro/config";
2024-01-17 11:37:24 +00:00
import sitemap from "@astrojs/sitemap"; //optional but recommended
2024-01-17 10:01:04 +00:00
import GhostCMS from '@matthiesenxyz/astro-ghostcms';
// https://astro.build/config
export default defineConfig({
site: "https://YOUR-DOMAIN-HERE.com"
integrations: [sitemap(), GhostCMS()],
});
```
2024-01-17 10:18:57 +00:00
2024-01-17 11:19:14 +00:00
#### Dont forget to set your environment Variables!
2024-01-17 10:01:04 +00:00
You must also create 2 environment variables in a `.env` file with the following:
```env
CONTENT_API_KEY=a33da3965a3a9fb2c6b3f63b48
CONTENT_API_URL=https://ghostdemo.matthiesen.xyz
```
**When you deploy your install dont forget to set the above ENVIRONMENT VARIABLES!**
#### Created Routes
The routes are the same as a standard Ghost Blog so you can migrate to Astro easily.
| Route | Content |
| --------------------- | ----------------------------------------- |
| `/` | Homepage with recents/features Blog Posts |
2024-01-21 13:41:42 +00:00
| `/404` | 404 Page |
2024-01-17 10:01:04 +00:00
| `/[slug]` | Post or Page |
| `/author/[slug]` | Author page with related posts |
| `/authors` | All the authors |
| `/tag[slug]` | Tag page with related posts |
| `/tags` | All the tags |
| `/archives/[...page]` | All the posts, paginated |
2024-01-21 08:53:46 +00:00
| `/rss.xml` | All the posts, in a FEED |
2024-01-17 10:01:04 +00:00
2024-01-17 11:19:14 +00:00
# Manual Function Mode (DIY MODE)
2024-01-17 10:01:04 +00:00
In this mode the integration will not deploy routes at all. you will have to build your own website to utilize the exported functions listed below.
2024-01-13 07:45:04 +00:00
```
2024-01-16 06:58:43 +00:00
npm i @matthiesenxyz/astro-ghostcms
2024-01-13 07:45:04 +00:00
```
2024-01-17 10:01:04 +00:00
You must also create 2 environment variables in a `.env` file with the following:
2024-01-13 07:45:04 +00:00
```env
CONTENT_API_KEY=a33da3965a3a9fb2c6b3f63b48
CONTENT_API_URL=https://ghostdemo.matthiesen.xyz
2024-01-13 07:45:04 +00:00
```
**When you deploy your install dont forget to set the above ENVIRONMENT VARIABLES!**
2024-01-19 11:08:04 +00:00
For more information please check our website: [Astro-GhostCMS.xyz](https://astro-ghostcms.xyz)