This commit is contained in:
Adam Matthiesen 2024-01-23 12:03:56 -08:00
parent c6ec669b36
commit f23f708f95
68 changed files with 7567 additions and 60 deletions

View File

@ -1,12 +1,15 @@
name: publish npm
name: Publish Astro-GhostCMS
on:
release:
types: [created]
types: [published]
jobs:
publishnpm:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./packages/astro-ghostcms
steps:
- name: checkout
uses: actions/checkout@v3
@ -29,6 +32,9 @@ jobs:
contents: read
packages: write
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./packages/astro-ghostcms
steps:
- name: checkout
uses: actions/checkout@v3

24
.github/workflows/lighthouse.yml vendored Normal file
View File

@ -0,0 +1,24 @@
name: Unlighthouse - Demo Site
on:
workflow_call:
jobs:
Unlighthouse-demo:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Install Dependencies
run: npm install -g @unlighthouse/cli puppeteer netlify-cli
- name: Unlighthouse assertions and client
run: unlighthouse-ci --site demo.astro-ghostcms.xyz --budget 75 --build-static
- name: Deploy
run: netlify deploy --dir=.unlighthouse --prod --message="New Release Deploy from GitHub Actions"
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}

View File

@ -1,19 +0,0 @@
## Checklist
- [ ] Update all `TODO:`
- [ ] Update all `package-name` occurences
- [ ] Add a LICENSE.md at the root
- [ ] Have gh cli installed
- [ ] Work on the integration logic
- [ ] Work on docs
- [ ] JSDoc
- [ ] Package README
- [ ] Format/lint (`pnpm lint:fix`)
- [ ] Setup GitHub repository
- [ ] Release (see below)
- [ ] Share!
To create a release:
- [ ] `pnpm run changeset`
- [ ] Commit and push
- [ ] `pnpm release`

2
demo/.env Normal file
View File

@ -0,0 +1,2 @@
CONTENT_API_KEY=a33da3965a3a9fb2c6b3f63b48
CONTENT_API_URL=https://ghostdemo.matthiesen.xyz

2
demo/.env.demo Normal file
View File

@ -0,0 +1,2 @@
CONTENT_API_KEY=a33da3965a3a9fb2c6b3f63b48
CONTENT_API_URL=https://ghostdemo.matthiesen.xyz

4
demo/.vscode/extensions.json vendored Normal file
View File

@ -0,0 +1,4 @@
{
"recommendations": ["astro-build.astro-vscode"],
"unwantedRecommendations": []
}

11
demo/.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,11 @@
{
"version": "0.2.0",
"configurations": [
{
"command": "./node_modules/.bin/astro dev",
"name": "Development server",
"request": "launch",
"type": "node-terminal"
}
]
}

21
demo/LICENSE Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2024 Matthiesen XYZ
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.

12
demo/README.md Normal file
View File

@ -0,0 +1,12 @@
# Astro-GhostCMS Demo Template
![Vercel](https://vercelbadge.vercel.app/api/matthiesenxyz/astro-ghostcms-demo)
This Repo is a Demo Website for the [@matthiesenxyz/astro-ghostcms](https://github.com/MatthiesenXYZ/astro-ghostcms) integraion.
- For a live preview goto [Demo.Astro-GhostCMS.xyz](https://demo.astro-ghostcms.xyz)
- To see the Current Lighthouse test that is ran every deployment goto [Test.Demo.Astro-GhostCMS.xyz](https://test.demo.astro-ghostcms.xyz)
### For more information Check our website
[Astro-GhostCMS.xyz](https://astro-ghostcms.xyz)

8
demo/astro.config.mjs Normal file
View File

@ -0,0 +1,8 @@
import { defineConfig } from 'astro/config';
import GhostCMS from "@matthiesenxyz/astro-ghostcms";
// https://astro.build/config
export default defineConfig({
site: "https://demo.astro-ghostcms.xyz/",
integrations: [GhostCMS()]
});

20
demo/package.json Normal file
View File

@ -0,0 +1,20 @@
{
"name": "demo",
"type": "module",
"version": "0.0.1",
"scripts": {
"dev": "astro dev",
"start": "astro dev",
"build": "astro check && astro build",
"preview": "astro preview",
"astro": "astro"
},
"dependencies": {
"@astrojs/check": "^0.4.1",
"@matthiesenxyz/astro-ghostcms": "^2.1.8",
"astro": "^4.2.0",
"astro-robots-txt": "^1.0.0",
"typescript": "^5.3.3",
"zod-validation-error": "^3.0.0"
}
}

9
demo/public/favicon.svg Normal file
View File

@ -0,0 +1,9 @@
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 128 128">
<path d="M50.4 78.5a75.1 75.1 0 0 0-28.5 6.9l24.2-65.7c.7-2 1.9-3.2 3.4-3.2h29c1.5 0 2.7 1.2 3.4 3.2l24.2 65.7s-11.6-7-28.5-7L67 45.5c-.4-1.7-1.6-2.8-2.9-2.8-1.3 0-2.5 1.1-2.9 2.7L50.4 78.5Zm-1.1 28.2Zm-4.2-20.2c-2 6.6-.6 15.8 4.2 20.2a17.5 17.5 0 0 1 .2-.7 5.5 5.5 0 0 1 5.7-4.5c2.8.1 4.3 1.5 4.7 4.7.2 1.1.2 2.3.2 3.5v.4c0 2.7.7 5.2 2.2 7.4a13 13 0 0 0 5.7 4.9v-.3l-.2-.3c-1.8-5.6-.5-9.5 4.4-12.8l1.5-1a73 73 0 0 0 3.2-2.2 16 16 0 0 0 6.8-11.4c.3-2 .1-4-.6-6l-.8.6-1.6 1a37 37 0 0 1-22.4 2.7c-5-.7-9.7-2-13.2-6.2Z" />
<style>
path { fill: #000; }
@media (prefers-color-scheme: dark) {
path { fill: #FFF; }
}
</style>
</svg>

After

Width:  |  Height:  |  Size: 749 B

52
demo/public/rss.xsl Normal file

File diff suppressed because one or more lines are too long

9
demo/src/env.d.ts vendored Normal file
View File

@ -0,0 +1,9 @@
/// <reference types="astro/client" />
interface ImportMetaEnv {
readonly CONTENT_API_KEY: string
readonly CONTENT_API_URL: string
}
interface ImportMeta {
readonly env: ImportMetaEnv;
}

3
demo/tsconfig.json Normal file
View File

@ -0,0 +1,3 @@
{
"extends": "astro/tsconfigs/strict"
}

View File

@ -7,6 +7,8 @@
},
"scripts": {
"playground:dev": "pnpm --filter playground dev",
"www:dev": "pnpm --filter www dev",
"demo:dev": "pnpm --filter demo dev",
"lint": "biome check .",
"lint:fix": "biome check --apply ."
},

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,6 @@
packages:
- package
- "packages/*"
- "playground"
- "playground"
- "www"
- "demo"

21
www/.gitignore vendored Normal file
View File

@ -0,0 +1,21 @@
# build output
dist/
# generated types
.astro/
# dependencies
node_modules/
# logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
# environment variables
.env
.env.production
# macOS-specific files
.DS_Store

1
www/README.md Normal file
View File

@ -0,0 +1 @@
Repo for Astro-ghostcms.xyz website

44
www/astro.config.mjs Normal file
View File

@ -0,0 +1,44 @@
import { defineConfig } from 'astro/config';
import fs from 'node:fs';
import { ExpressiveCodeTheme } from '@astrojs/starlight/expressive-code';
import starlight from "@astrojs/starlight";
const houstonFile = `./houston-vscode.jsonc`;
const houston = fs.readFileSync(
new URL(houstonFile, import.meta.url),'utf-8');
const houstonTheme = ExpressiveCodeTheme.fromJSONString(houston);
// https://astro.build/config
export default defineConfig({
site: 'https://astro-ghostcms.xyz',
integrations: [
starlight({
title: 'Astro-GhostCMS',
logo: {
src: './src/assets/favicon.svg'
},
favicon: 'favicon.svg',
customCss: [ './src/styles/starlight.css' ],
expressiveCode: { themes: [ houstonTheme ] },
social: {
github: 'https://github.com/MatthiesenXYZ/astro-ghostcms',
},
sidebar: [
{ label: 'Docs Home', link: '/docs/' },
{ label: 'Introduction', items: [
{ label: 'Getting Started', link: '/docs/introduction/getting-started' },
{ label: 'Integration Mode', items: [
{ label: 'Quick Install', link: '/docs/introduction/integration/quick' },
{ label: 'Manual Install', link: '/docs/introduction/integration/manual' },
{ label: 'Configuration Options', link: '/docs/introduction/integration/config',
badge: { text: 'BETA', variant: 'caution' }, }, ], },
{ label: 'API ( DIY ) Mode', items: [
{ label: 'Install', link: '/docs/introduction/api/install' },
{ label: 'Basic API Usage', link: '/docs/introduction/api/usage' }, ], }, ], },
//{ label: 'Advanced Usage', link: '/docs/#' },
{ label: 'Tutorials', autogenerate: { directory: 'docs/tutorials' }, },
{ label: 'Reference', autogenerate: { directory: 'docs/reference' }, },
],
}),
],
});

2369
www/houston-vscode.jsonc Normal file

File diff suppressed because it is too large Load Diff

20
www/package.json Normal file
View File

@ -0,0 +1,20 @@
{
"name": "www",
"type": "module",
"version": "0.0.1",
"scripts": {
"dev": "astro dev",
"start": "astro dev",
"build": "astro check && astro build",
"preview": "astro preview",
"astro": "astro"
},
"dependencies": {
"@astrojs/check": "^0.4.1",
"@astrojs/starlight": "^0.15.4",
"astro": "^4.2.0",
"sass": "^1.69.5",
"sharp": "^0.32.6",
"typescript": "^5.3.3"
}
}

BIN
www/public/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 264 KiB

1
www/public/favicon.svg Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 1.3 MiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 1.3 MiB

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,5 @@
# First Create a fresh Astro Install
npm create astro@latest
# Create Empty Install with standard typescript
# Then Delete entire 'pages' folder under '/src/'
npx astro add @matthiesenxyz/astro-ghostcms

View File

@ -0,0 +1,21 @@
---
import { ViewTransitions } from 'astro:transitions';
import SEO, { type Props as SEOProps } from './SEO.astro';
import { SiteTitle, SiteDescription } from '../consts';
import favicon from '../assets/favicon.svg';
export type Props = Partial<SEOProps>;
const { title = SiteTitle, name = SiteTitle, description = SiteDescription, ...seo } = Astro.props;
---
<SEO {title} {description} {name} {...seo} />
<link rel="icon" type="image/svg" href={favicon.src} />
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Lato:wght@400;700&family=Source+Code+Pro&display=swap"
rel="stylesheet"
/>
<ViewTransitions />

View File

@ -0,0 +1,12 @@
---
import '../styles/global.scss';
---
<footer>
<p>© MatthiesenXYZ 2024</p>
<div class="footer_links">
<a href="/archive">Previous Release Archives</a>
<a href="https://github.com/MatthiesenXYZ/astro-ghostcms">GitHub</a>
<a href="https://matthiesen.xyz">MatthiesenXYZ</a>
</div>
</footer>

View File

@ -0,0 +1,25 @@
---
import type { HTMLAttributes } from 'astro/types';
type Props = HTMLAttributes<'time'> & {
date: Date;
};
const { date, ...attrs } = Astro.props;
---
<time datetime={date.toISOString()} {...attrs}>
{
date.toLocaleDateString('en-us', {
year: 'numeric',
month: 'short',
day: 'numeric',
})
}
</time>
<style>
time {
display: block;
}
</style>

View File

@ -0,0 +1,4 @@
---
---
<div>Astro-GhostCMS is independently maintained and not provided by Ghost or <a href="https://astro.build">Astro</a>, Ghost is a trademark of <a href="https://ghost.org">The Ghost Foundation</a>.</div>

View File

@ -0,0 +1,30 @@
---
import '../styles/global.scss';
import { SiteTitle } from '../consts';
import favicon from '../assets/favicon.svg'
import { Image } from 'astro:assets';
---
<header>
<nav>
<h2 id="site_title">
<a href="/">
<Image src={favicon} alt="logo" width={64}/>
{SiteTitle}
</a>
</h2>
<div class="links">
<a href="https://demo.astro-ghostcms.xyz" target="_blank">Live Demo</a>
<a href="https://test.demo.astro-ghostcms.xyz" target="_blank">Lighthouse Report</a>
<a href="/docs" target="">Docs</a>
<a href="https://www.npmjs.com/package/@matthiesenxyz/astro-ghostcms" target="_blank">NPM</a>
<a href="https://github.com/matthiesenxyz/astro-ghostcms" target="_blank">GitHub</a>
</div>
</nav>
</header>
<style>
.links a {
text-decoration: none;
}
</style>

View File

@ -0,0 +1,14 @@
---
import { Code } from "astro:components"
import quickstart from "../assets/quickstart.sh?raw"
---
<div class="quickstart">
<center>
<div class="qstart"> /|\ Astro-GhostCMS Quickstart /|\ </div>
</center>
<Code lang={'sh'} code={quickstart}/>
</div>

View File

@ -0,0 +1,87 @@
---
import type { ImageMetadata } from 'astro';
type Image = {
src: string | ImageMetadata;
alt: string;
};
type SEOMetadata = {
name: string;
title: string;
description: string;
image?: Image | undefined;
canonicalURL?: URL | string | undefined;
locale?: string;
};
type OpenGraph = Partial<SEOMetadata> & {
type?: string;
};
type Twitter = Partial<SEOMetadata> & {
handle?: string;
card?: 'summary' | 'summary_large_image';
};
export type Props = SEOMetadata & {
og?: OpenGraph;
twitter?: Twitter;
};
const {
name,
title,
description,
image,
locale = 'en',
canonicalURL = new URL(Astro.url.pathname, Astro.site),
} = Astro.props;
const og = {
name,
title,
description,
canonicalURL,
image,
locale,
type: 'website',
...(Astro.props.og ?? {}),
} satisfies OpenGraph;
const twitter = {
name,
title,
description,
canonicalURL,
image,
locale,
card: 'summary_large_image',
...Astro.props.twitter,
};
function normalizeImageUrl(image: string | ImageMetadata) {
return typeof image === 'string' ? image : image.src;
}
---
<!-- Page Metadata -->
<link rel="canonical" href={canonicalURL} />
<meta name="description" content={description} />
<!-- OpenGraph Tags -->
<meta property="og:title" content={og.title} />
<meta property="og:type" content={og.type} />
<meta property="og:url" content={canonicalURL} />
<meta property="og:locale" content={og.locale} />
<meta property="og:description" content={og.description} />
<meta property="og:site_name" content={og.name} />
{og.image && <meta property="og:image" content={normalizeImageUrl(og.image.src)} />}
{og.image && <meta property="og:image:alt" content={og.image.alt} />}
<!-- Twitter Tags -->
<meta name="twitter:card" content={twitter.card} />
<meta name="twitter:site" content={twitter.handle} />
<meta name="twitter:title" content={twitter.title} />
<meta name="twitter:description" content={twitter.description} />
{twitter.image && <meta name="twitter:image" content={normalizeImageUrl(twitter.image.src)} />}
{twitter.image && <meta name="twitter:image:alt" content={twitter.image.alt} />}

5
www/src/consts.ts Normal file
View File

@ -0,0 +1,5 @@
// Place any global data in this file.
// You can import this data from anywhere in your site by using the `import` keyword.
export const SiteTitle = 'Astro-GhostCMS';
export const SiteDescription = 'Astro-GhostCMS Integration & API';

View File

@ -0,0 +1,48 @@
---
title: 'Introducing Astro-GhostCMS.xyz!'
date: '01-17-2024'
versionNumber: '2.0.5'
description: 'This is the First Release posted to our new website!'
#image:
# src: '../../assets/starlog-placeholder-2.jpg'
# alt: 'The full Astro logo.'
---
## Introducing Astro-GhostCMS.xyz!
Greetings, Astro-GhostCMS users! We're happy to announce the launch of our new website astro-ghostcms.xyz a central location to get all your relevent updates regarding our Astro-GhostCMS integration!
### Welcome to Astro-GhostCMS
- [Live Demo](https://demo.astro-ghostcms.xyz/) of the Astro-GhostCMS integration in action!
- [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**
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.
- *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)
- 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.
### Quick Start : 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.
## Astro Add Installation
```sh
# For fresh Install
npm create astro@latest
# Create Empty Install with standard typescript
# Then Delete entire `pages` folder under `/src/`
npx astro add @matthiesenxyz/astro-ghostcms
```
#### Dont forget to set your environment Variables!
You must also create 2 environment variables in a `.env` file with the following(*Below info is for DEMO Purposes. Please generate your own API_KEY for your Ghost install.*):
```ansi frame="code" title=".env"
CONTENT_API_KEY=a33da3965a3a9fb2c6b3f63b48
CONTENT_API_URL=https://ghostdemo.matthiesen.xyz
```

View File

@ -0,0 +1,13 @@
---
title: 'New Feature: Theming (BETA)'
date: '01-18-2024'
versionNumber: '2.0.8'
description: 'New Feature Alert! Theming!'
#image:
# src: '../../assets/starlog-placeholder-2.jpg'
# alt: 'The full Astro logo.'
---
## New Feature: Themes (BETA)!
As of posting this there is now a new undocumented feature. Themes! this feature will allow the end-user the option of changing how their website's astro-ghostcms install looks and functons! I will be building a Theme Skeleton and then documentation for this new feature. Stay tuned for more updates as this is a beta feature!

35
www/src/content/config.ts Normal file
View File

@ -0,0 +1,35 @@
import { defineCollection, z } from 'astro:content';
import { docsSchema } from '@astrojs/starlight/schema';
const releases = defineCollection({
schema: ({ image }) =>
z.object({
title: z.string(),
description: z.string(),
versionNumber: z.string(),
image: z.object({
src: image(),
alt: z.string(),
}).optional(),
date: z.date({ coerce: true }),
}),
});
const archivedreleases = defineCollection({
schema: ({ image }) =>
z.object({
title: z.string(),
description: z.string(),
versionNumber: z.string(),
image: z.object({
src: image(),
alt: z.string(),
}).optional(),
date: z.date({ coerce: true }),
}),
});
export const collections = {
docs: defineCollection({ schema: docsSchema() }),
releases, archivedreleases,
};

View File

@ -0,0 +1,11 @@
---
title: Welcome to the Docs
description: Learn more about Astro-GhostCMS - Docs built on Starlight
---
Demo site status:
![Vercel](https://vercelbadge.vercel.app/api/matthiesenxyz/astro-ghostcms-demo)
Welcome to the Astro-GhostCMS Docs! Powered by Starlight & Astro.build!
Here you will find a document reference for the Astro-GhostCMS Integration & API

View File

@ -0,0 +1,34 @@
---
title: API Only Mode - Install
description: API Only Mode - Install
---
# API Mode Install
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.
```sh
npx astro add @matthiesenxyz/astro-ghostcms
```
You must also create 2 environment variables in a `.env` file with the following:
```ansi frame="code" title=".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!***
Then Change your astro config option in `astro.config.ts` to looks like this:
```ts frame="code" title="astro.config.ts"
import { defineConfig } from "astro/config";
import GhostCMS from '@matthiesenxyz/astro-ghostcms';
export default defineConfig({
site: "https://YOUR-DOMAIN-HERE.com",
// THIS WILL DISABLE DEFAULT ROUTE INJECT
integrations: [ GhostCMS({ disableRouteInjection: true })],
});
```

View File

@ -0,0 +1,136 @@
---
title: API Only Mode - Basic Usage
description: API Only Mode - Basic Usage
---
## Manual Function Usage Examples:
### getGhostPosts() - Get list of posts
```astro frame="code" title="getGhostPosts()"
---
// 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 frame="code" title="getGhostRecentPosts()"
---
// 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 frame="code" title="getGhostFeaturedPosts()"
---
// 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 frame="code" title="getGhostPostbySlug()"
---
// 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 frame="code" title="getGhostPostbyTag()"
---
// 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 frame="code" title="getGhostTag()"
---
// 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 frame="code" title="getGhostAuthors()"
---
// 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 frame="code" title="getGhostPages()"
---
// 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 frame="code" title="getGhostPage()"
---
// 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 frame="code" title="getGhostSettings()"
---
// IMPORT {GET} GhostAuthors Function
import { getGhostSettings } from "@matthiesenxyz/astro-ghostcms/api";
// GET LIST OF ALL AUTHORS
const ghostSettings = await getGhostSettings();
---
```

View File

@ -0,0 +1,17 @@
---
title: Getting Started with Astro-GhostCMS
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.
Astro minimum Version: **Astro v4.0**
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.
- *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)
- The default theme 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.

View File

@ -0,0 +1,50 @@
---
title: Integration Mode - Configuration Options
description: Integration Mode - Configuration Options
---
### This is still a *BETA* Feature
Theme config option in `astro.config.ts` looks like this:
```ts frame="code" title="astro.config.ts"
import { defineConfig } from "astro/config";
import GhostCMS from '@matthiesenxyz/astro-ghostcms';
export default defineConfig({
site: "https://YOUR-DOMAIN-HERE.com",
integrations: [
GhostCMS({
// *OPTIONAL* THIS Option allows the user to disable default route
// injections, disabling the default layout and theme all together.
// Allowing the user to still use integration features while building
// off of the included API functions
disableRouteInjection: false // DEFAULT VALUE
// *OPTIONAL* Setting this to true will disable the extra info logs
disableConsoleOutput: false // DEFAULT VALUE
// *OPTIONAL* THIS IS THE DEFAULT VALUE
theme: '@matthiesenxyz/astro-ghostcms',
// THIS IS TO SHOW SUPPORTED FEATURES FOR MORE INFO SEE
// npm:@astrojs/sitemap package README
sitemap: {
customPages: // OPTIONAL - string[]
entryLimit: // OPTIONAL - number
}
// THIS IS TO SHOW SUPPORTED FEATURES FOR MORE INFO SEE
// npm:astro-robots-txt package README
robotstxt: {
host: // OPTIONAL - string
sitemap: // OPTIONAL - string
sitemapBaseFileName: // OPTIONAL - string
policy: { // OPTIONAL
userAgent: // REQUIRED IF POLICY IS PRESENT - string
allow: // OPTIONAL - string
disallow: //OPTIONAL - string
cleanParam: //OPTIONAL - string
crawlDelay: //OPTIONAL - number
}
}
}),
],
});
```

View File

@ -0,0 +1,49 @@
---
title: Integration Mode - Manual Install
description: Integration Mode - Manual Install
---
## Install
```sh
npm i @matthiesenxyz/astro-ghostcms
```
Then set your `astro.config.ts` to look like this:
```ts frame="code" title="astro.config.ts"
import { defineConfig } from "astro/config";
import GhostCMS from '@matthiesenxyz/astro-ghostcms';
// https://astro.build/config
export default defineConfig({
site: "https://YOUR-DOMAIN-HERE.com"
integrations: [GhostCMS()],
});
```
## Setup `.env` variables
```ansi frame="code" title=".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 |
| `/404` | 404 Page |
| `/[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 |
| `/rss.xml` | All the posts, in a FEED |

View File

@ -0,0 +1,39 @@
---
title: Integration Mode - Quick Install
description: Integration Mode - Quick Install
---
## Install
```sh
# For fresh Install
npm create astro@latest
# Create Empty Install with standard typescript
# Then Delete entire `pages` folder under `/src/`
npx astro add @matthiesenxyz/astro-ghostcms
```
## Setup `.env` variables
```ansi frame="code" title=".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 |
| `/404` | 404 Page |
| `/[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 |
| `/rss.xml` | All the posts, in a FEED |

View File

@ -0,0 +1,205 @@
---
title: Ghost Content API References
description: Ghost Content API References
---
- [Main Content API Docs (ghost.org)](https://ghost.org/docs/content-api/)
## Example of Posts Output
```json frame="code" title="Posts"
{
"posts": [
{
"slug": "welcome-short",
"id": "5c7ece47da174000c0c5c6d7",
"uuid": "3a033ce7-9e2d-4b3b-a9ef-76887efacc7f",
"title": "Welcome",
"html": "<p>👋 Welcome, it's great to have you here.</p>",
"comment_id": "5c7ece47da174000c0c5c6d7",
"feature_image": "https://casper.ghost.org/v2.0.0/images/welcome-to-ghost.jpg",
"feature_image_alt": null,
"feature_image_caption": null,
"featured": false,
"meta_title": null,
"meta_description": null,
"created_at": "2019-03-05T19:30:15.000+00:00",
"updated_at": "2019-03-26T19:45:31.000+00:00",
"published_at": "2012-11-27T15:30:00.000+00:00",
"custom_excerpt": "Welcome, it's great to have you here.",
"codeinjection_head": null,
"codeinjection_foot": null,
"og_image": null,
"og_title": null,
"og_description": null,
"twitter_image": null,
"twitter_title": null,
"twitter_description": null,
"custom_template": null,
"canonical_url": null,
"authors": [
{
"id": "5951f5fca366002ebd5dbef7",
"name": "Ghost",
"slug": "ghost",
"profile_image": "https://demo.ghost.io/content/images/2017/07/ghost-icon.png",
"cover_image": null,
"bio": "The professional publishing platform",
"website": "https://ghost.org",
"location": null,
"facebook": "ghost",
"twitter": "@tryghost",
"meta_title": null,
"meta_description": null,
"url": "https://demo.ghost.io/author/ghost/"
}
],
"tags": [
{
"id": "59799bbd6ebb2f00243a33db",
"name": "Getting Started",
"slug": "getting-started",
"description": null,
"feature_image": null,
"visibility": "public",
"meta_title": null,
"meta_description": null,
"url": "https://demo.ghost.io/tag/getting-started/"
}
],
"primary_author": {
"id": "5951f5fca366002ebd5dbef7",
"name": "Ghost",
"slug": "ghost",
"profile_image": "https://demo.ghost.io/content/images/2017/07/ghost-icon.png",
"cover_image": null,
"bio": "The professional publishing platform",
"website": "https://ghost.org",
"location": null,
"facebook": "ghost",
"twitter": "@tryghost",
"meta_title": null,
"meta_description": null,
"url": "https://demo.ghost.io/author/ghost/"
},
"primary_tag": {
"id": "59799bbd6ebb2f00243a33db",
"name": "Getting Started",
"slug": "getting-started",
"description": null,
"feature_image": null,
"visibility": "public",
"meta_title": null,
"meta_description": null,
"url": "https://demo.ghost.io/tag/getting-started/"
},
"url": "https://demo.ghost.io/welcome-short/",
"excerpt": "Welcome, it's great to have you here."
}
]
}
```
## Example of Tags Output
```json frame="code" title="Tags"
{
"tags": [
{
"slug": "getting-started",
"id": "5ddc9063c35e7700383b27e0",
"name": "Getting Started",
"description": null,
"feature_image": null,
"visibility": "public",
"meta_title": null,
"meta_description": null,
"og_image": null,
"og_title": null,
"og_description": null,
"twitter_image": null,
"twitter_title": null,
"twitter_description": null,
"codeinjection_head": null,
"codeinjection_foot": null,
"canonical_url": null,
"accent_color": null,
"url": "https://docs.ghost.io/tag/getting-started/"
}
]
}
```
## Example of Authors Output
```json frame="code" title="Authors"
{
"authors": [
{
"slug": "cameron",
"id": "5ddc9b9510d8970038255d02",
"name": "Cameron Almeida",
"profile_image": "https://docs.ghost.io/content/images/2019/03/1c2f492a-a5d0-4d2d-b350-cdcdebc7e413.jpg",
"cover_image": null,
"bio": "Editor at large.",
"website": "https://example.com",
"location": "Cape Town",
"facebook": "example",
"twitter": "@example",
"meta_title": null,
"meta_description": null,
"url": "https://docs.ghost.io/author/cameron/"
}
]
}
```
## Example of Settings Output
```json frame="code" title="Settings"
{
"settings": {
"title": "Ghost",
"description": "The professional publishing platform",
"logo": "https://docs.ghost.io/content/images/2014/09/Ghost-Transparent-for-DARK-BG.png",
"icon": "https://docs.ghost.io/content/images/2017/07/favicon.png",
"accent_color": null,
"cover_image": "https://docs.ghost.io/content/images/2019/10/publication-cover.png",
"facebook": "ghost",
"twitter": "@tryghost",
"lang": "en",
"timezone": "Etc/UTC",
"codeinjection_head": null,
"codeinjection_foot": "<script src=\"//rum-static.pingdom.net/pa-5d8850cd3a70310008000482.js\" async></script>",
"navigation": [
{
"label": "Home",
"url": "/"
},
{
"label": "About",
"url": "/about/"
},
{
"label": "Getting Started",
"url": "/tag/getting-started/"
},
{
"label": "Try Ghost",
"url": "https://ghost.org"
}
],
"secondary_navigation": [],
"meta_title": null,
"meta_description": null,
"og_image": null,
"og_title": null,
"og_description": null,
"twitter_image": null,
"twitter_title": null,
"twitter_description": null,
"members_support_address": "noreply@docs.ghost.io",
"url": "https://docs.ghost.io/"
}
}
```

View File

@ -0,0 +1,9 @@
---
title: Unlighthouse Report Lists
description: Unlighthouse Report Lists
---
Below you will find a list of links to different lighthouse reports generated using [Unlighthouse](https://unlighthouse.dev)'s CI utility
- [Main Demo](https://test.demo.astro-ghostcms.xyz)
- [Base Theme Demo](https://test.basetheme-demo.astro-ghostcms.xyz)

View File

@ -0,0 +1,13 @@
---
title: 'We now have automated Lighthouse Reports with Unlighthouse!'
date: '01-19-2024'
versionNumber: 'POST'
description: 'New Feature Alert! Theming!'
#image:
# src: '../../assets/starlog-placeholder-2.jpg'
# alt: 'The full Astro logo.'
---
## We now have automated Lighthouse Reports with Unlighthouse!!
Hello! Our Main Demo site now autogenerates a Lighthouse Report every deployment! To see this test at any point just goto [test.demo.astro-ghostcms.xyz](https://test.demo.astro-ghostcms.xyz) eventually the goal will be to have a `test.*` domain for each of the themes as well to be able to demonstrate lighthouse scores for each of our inhouse projects!

View File

@ -0,0 +1,20 @@
---
title: 'Updates & Bug Fixes'
date: '01-20-2024 08:00'
versionNumber: '2.1.0'
description: 'Updates & Bug Fixes'
#image:
# src: '../../assets/starlog-placeholder-2.jpg'
# alt: 'The full Astro logo.'
---
## Updates
This patch resolved some outstanding issues with the api integration itself. There had been some issues with types being imported and not working. that is now solved.
RSS Implentation is successful, Integration now checks that .env file exisits with the required values set.
New Features in progress:
- sitemap integration
- robots integration
- rss styling

View File

@ -0,0 +1,22 @@
---
title: 'Updates & Bug Fixes'
date: '01-20-2024 11:00'
versionNumber: '2.1.3'
description: 'Updates & Bug Fixes'
#image:
# src: '../../assets/starlog-placeholder-2.jpg'
# alt: 'The full Astro logo.'
---
## Bug Fixes & New Config Options
### Fixes:
This patch resolved the issues that were causing sitemap, and robots to not load fully. Issue now resolved.
### New:
This patch also creates new Configuration Options for Sitemap and RobotsTxt allowing the user to modify the integrated plugins instead of having to run them independently from this Integration. More info on the Docs.
#### Features in progress:
- rss styling

View File

@ -0,0 +1,22 @@
---
title: 'IntelliSense Docs Integration!'
date: '01-20-2024 14:40'
versionNumber: '2.1.5'
description: 'IntelliSense Docs Integration!'
#image:
# src: '../../assets/starlog-placeholder-2.jpg'
# alt: 'The full Astro logo.'
---
## IntelliSense Docs Integration!
### Fixes:
Unnoted v2.1.4 was supposed to add jsDocs to our IntelliSense but that caused all sorts of errors at first. But we are glad to announce, IT IS NOW WORKING! now while you are trying to setup your config it will give you some help!
### New:
- IntelliSense jsDoc Integration(Resources right in your code editor)!
#### Features in progress:
- rss styling

View File

@ -0,0 +1,23 @@
---
title: 'More Features! and a 404 page!'
date: '01-21-2024 01:20'
versionNumber: '2.1.7'
description: 'More Features! and a 404 page!'
#image:
# src: '../../assets/starlog-placeholder-2.jpg'
# alt: 'The full Astro logo.'
---
## More Features! and a 404 page!
### Fixes:
v2.1.6 & v2.1.7 include updates to include a new 404 page route, as well clean up a bunch of internal code.
### New:
- New options that allow users to disable both console logging and the default route injection
#### Features in progress:
- rss styling

View File

@ -0,0 +1,17 @@
---
title: 'Minior Bug fixes & some code cleanup'
date: '01-21-2024 07:00'
versionNumber: '2.1.8'
description: 'Minior Bug fixes & some code cleanup'
#image:
# src: '../../assets/starlog-placeholder-2.jpg'
# alt: 'The full Astro logo.'
---
## Minior Bug fixes & some code cleanup
Nothing Major in this update, i went through and cleaned up and reorganized some files and code. No breaking changes no bugs.
#### Features in progress:
- rss styling

2
www/src/env.d.ts vendored Normal file
View File

@ -0,0 +1,2 @@
/// <reference path="../.astro/types.d.ts" />
/// <reference types="astro/client" />

View File

@ -0,0 +1,41 @@
---
import type { CollectionEntry } from 'astro:content';
import BaseHead from '../components/BaseHead.astro';
import FormattedDate from '../components/FormattedDate.astro';
import Header from '../components/Header.astro';
import Footer from '../components/Footer.astro';
import { SiteTitle } from '../consts';
type Props = {
arrelease: CollectionEntry<'archivedreleases'>;
};
const { arrelease } = Astro.props;
---
<!doctype html>
<html lang="en">
<head>
<title>{arrelease.data.versionNumber} | {SiteTitle}</title>
<BaseHead
title={arrelease.data.title}
description={arrelease.data.description}
image={arrelease.data.image}
/>
</head><body>
<div class="glow"></div>
<Header />
<div class="post single" transition:persist transition:name="post">
<div class="version_wrapper">
<div class="version_info">
<div class="version_number">{arrelease.data.versionNumber}</div>
<FormattedDate class="date" date={arrelease.data.date} />
</div>
</div>
<div class="content">
<slot />
</div>
</div>
<Footer />
</body>
</html>

View File

@ -0,0 +1,27 @@
---
import BaseHead, { type Props as HeadProps } from '../components/BaseHead.astro';
import Header from '../components/Header.astro';
import Footer from '../components/Footer.astro';
import { SiteTitle } from '../consts';
import GhostAstroFooter from '../components/GhostAstroFooter.astro';
type Props = HeadProps;
const { ...head } = Astro.props;
---
<!doctype html>
<meta charset="utf-8" />
<html lang="en">
<head>
<title>{SiteTitle} </title>
<BaseHead {...head} />
<body>
<div class="glow"></div>
<Header />
<slot />
<GhostAstroFooter />
<Footer />
</body>
</head>
</html>

View File

@ -0,0 +1,41 @@
---
import type { CollectionEntry } from 'astro:content';
import BaseHead from '../components/BaseHead.astro';
import FormattedDate from '../components/FormattedDate.astro';
import Header from '../components/Header.astro';
import Footer from '../components/Footer.astro';
import { SiteTitle } from '../consts';
type Props = {
release: CollectionEntry<'releases'>;
};
const { release } = Astro.props;
---
<!doctype html>
<html lang="en">
<head>
<title>{release.data.versionNumber} | {SiteTitle}</title>
<BaseHead
title={release.data.title}
description={release.data.description}
image={release.data.image}
/>
</head><body>
<div class="glow"></div>
<Header />
<div class="post single" transition:persist transition:name="post">
<div class="version_wrapper">
<div class="version_info">
<div class="version_number">{release.data.versionNumber}</div>
<FormattedDate class="date" date={release.data.date} />
</div>
</div>
<div class="content">
<slot />
</div>
</div>
<Footer />
</body>
</html>

View File

@ -0,0 +1,21 @@
---
import { getCollection } from 'astro:content';
import Layout from '../../layouts/ArchivePostLayout.astro';
export async function getStaticPaths() {
const arreleases = await getCollection('archivedreleases');
return arreleases.map((arrelease) => ({
params: { slug: arrelease.slug },
props: { arrelease },
}));
}
const { arrelease } = Astro.props;
const { Content } = await arrelease.render();
---
<Layout {arrelease}>
<Content />
</Layout>

View File

@ -0,0 +1,37 @@
---
import { getCollection } from 'astro:content';
import FormattedDate from '../../components/FormattedDate.astro';
import Layout from '../../layouts/IndexLayout.astro';
const posts = await getCollection('archivedreleases');
posts.sort((a, b) => +b.data.date - +a.data.date);
---
<Layout>
<main>
<hr />
<h1 class="page_title">Previous Version Archive</h1>
<hr />
<ul class="posts" transition:name="post">
{
posts.map((post) => (
<li class="post">
<div class="version_wrapper">
<div class="version_info">
<a href={`/archive/${post.slug}`}>
<div class="version_number">{post.data.versionNumber}</div>
<FormattedDate class="date" date={post.data.date} />
</a>
</div>
</div>
<div class="content">
{post.render().then(({ Content }) => (
<Content />
))}
</div>
</li>
))
}
</ul>
</main>
</Layout>

41
www/src/pages/index.astro Normal file
View File

@ -0,0 +1,41 @@
---
import { getCollection } from 'astro:content';
import FormattedDate from '../components/FormattedDate.astro';
import Layout from '../layouts/IndexLayout.astro';
import QuickStart from '../components/QuickStart.astro';
const posts = await getCollection('releases');
posts.sort((a, b) => +b.data.date - +a.data.date);
---
<Layout>
<main>
<hr />
<div>Astro-GhostCMS is an Astro v4 Integration and API, its purpose is to create a easy way to bring your GhostCMS content into the Astro world. Create super fast websites, and customize to your hearts content. With the content being pulled from your headless GhostCMS install, all you do is build the layout with the info you want and your on your way!</div>
<QuickStart />
<hr />
<h1 class="page_title">News & Changelog</h1>
<hr />
<ul class="posts" transition:name="post">
{
posts.map((post) => (
<li class="post">
<div class="version_wrapper">
<div class="version_info">
<a href={`/releases/${post.slug}`}>
<div class="version_number">{post.data.versionNumber}</div>
<FormattedDate class="date" date={post.data.date} />
</a>
</div>
</div>
<div class="content">
{post.render().then(({ Content }) => (
<Content />
))}
</div>
</li>
))
}
</ul>
</main>
</Layout>

View File

@ -0,0 +1,21 @@
---
import { getCollection } from 'astro:content';
import Layout from '../../layouts/PostLayout.astro';
export async function getStaticPaths() {
const releases = await getCollection('releases');
return releases.map((release) => ({
params: { slug: release.slug },
props: { release },
}));
}
const { release } = Astro.props;
const { Content } = await release.render();
---
<Layout {release}>
<Content />
</Layout>

View File

@ -0,0 +1,61 @@
@function color($color, $tone) {
// @warn map-get($palette,$color);
@if map-has-key($palette, $color) {
$color: map-get($palette, $color);
@if map-has-key($color, $tone) {
$tone: map-get($color, $tone);
@return $tone;
}
@warn "unknown tone `#{$tone}` in color";
@return null;
}
@warn "unknown color `#{$color}` in palette";
@return null;
}
$white: #ffffff;
$palette: (
purple: (
50: #f2e8fd,
100: #e6d1fa,
200: #cfa3f5,
300: #ba75f0,
400: #a846ec,
500: #9818e7,
600: #7b13b4,
700: #5b0e81,
800: #3a084e,
900: #15031c,
950: #020002,
),
orange: (
50: #fbf0ea,
100: #f8e3d9,
200: #f2cab7,
300: #ecb194,
400: #e59872,
500: #df7f4f,
600: #d05f26,
700: #a1491d,
800: #713315,
900: #421e0c,
950: #2a1308,
),
gray: (
50: #f6f6f9,
100: #e6e7ef,
200: #c7c9db,
300: #a8abc7,
400: #898eb4,
500: #6a71a0,
600: #545b83,
700: #404664,
800: #2c3145,
900: #181b26,
950: #0e1016,
),
);

View File

@ -0,0 +1,3 @@
@import 'colors.scss';
@import 'type.scss';
@import 'layout.scss';

291
www/src/styles/layout.scss Normal file
View File

@ -0,0 +1,291 @@
$container: 1040px;
$tablet: 768px;
$mobile: 420px;
* {
box-sizing: border-box;
}
body {
margin: 0 auto;
padding: 0 1em;
width: 1040px;
max-width: 100%;
background-color: $white;
@media (prefers-color-scheme: dark) {
background-color: color(gray, 950);
}
@media (max-width: $tablet) {
font-size: 16px;
}
}
.glow {
width: 100%;
height: 100%;
position: absolute;
z-index: -1;
top: 0;
left: 0;
overflow: hidden;
&:after {
content: '';
display: block;
position: absolute;
top: -120px;
left: calc(50% - 360px);
width: 720px;
height: 240px;
background: radial-gradient(
50% 50% at 50% 50%,
rgba(color(orange, 500), 0.2) 0%,
rgba(color(orange, 500), 0) 100%
);
@media (prefers-color-scheme: dark) {
background: radial-gradient(
50% 50% at 50% 50%,
rgba(255, 255, 255, 0.06) 0%,
rgba(255, 255, 255, 0) 100%
);
}
}
}
::selection {
background: color(orange, 200);
@media (prefers-color-scheme: dark) {
background: color(orange, 600);
}
}
a,
a:visited {
color: color(orange, 600);
@media (prefers-color-scheme: dark) {
color: color(orange, 300);
}
transition: 0.1s ease;
&:hover {
color: color(orange, 500);
}
}
hr {
margin: 1em 0;
border: 0;
border-bottom: 1px solid color(gray, 100);
@media (prefers-color-scheme: dark) {
border-color: color(gray, 900);
}
}
nav {
display: flex;
align-items: center;
justify-content: space-between;
margin: 0 0 2em 0;
padding: 2em 0;
a {
transition: 0.1s ease;
&:hover {
opacity: 0.6;
}
}
#site_title {
margin: 0;
}
#site_title a {
display: flex;
align-items: center;
gap: 10px;
color: color(gray, 950);
@media (prefers-color-scheme: dark) {
color: $white;
}
font-size: 16px;
font-weight: 700;
letter-spacing: 2px;
line-height: 1;
text-decoration: none;
text-transform: uppercase;
}
.links a {
margin-left: 1em;
color: color(gray, 800);
@media (prefers-color-scheme: dark) {
color: color(gray, 200);
}
}
}
.content {
ol,
ul {
padding-left: 2em;
margin-bottom: 1em;
}
ul {
list-style: none;
li {
position: relative;
margin-bottom: 0.75em;
&:before {
content: '';
display: block;
position: absolute;
left: -1em;
top: 0.63em;
width: 8px;
height: 8px;
background: linear-gradient(25deg, color(purple, 500), color(orange, 500));
border-radius: 99px;
}
}
}
}
.page_title {
margin: 1.5em 0;
@media (max-width: $tablet) {
margin: 0.5em 0;
}
}
.posts {
list-style: none;
padding: 0;
}
.post {
display: flex;
width: 100%;
@media (max-width: $tablet) {
flex-flow: column;
}
&:last-child .content,
&.single .content {
border-bottom: 0;
}
}
.version_wrapper {
flex-basis: 260px;
@media (max-width: $container) {
flex-basis: 140px;
}
flex-grow: 0;
flex-shrink: 0;
margin: 4.5em 0 0 0;
@media (max-width: $tablet) {
flex-basis: 0;
margin-top: 2em;
}
.version_info {
position: sticky;
top: 1em;
@media (max-width: $tablet) {
position: relative;
top: 0;
}
}
a {
float: left;
color: $white;
text-decoration: none;
transition: 0.1s ease;
&:hover {
opacity: 0.6;
}
}
}
.version_number {
display: inline-block;
font-family: $codeFont;
line-height: 1;
margin-bottom: 8px;
padding: 4px 12px;
color: $white;
background: linear-gradient(
25deg,
color(purple, 800),
color(purple, 700),
mix(color(purple, 500), color(orange, 500)),
color(orange, 500)
);
border-radius: 8px;
}
.date {
clear: both;
@media (max-width: $tablet) {
display: inline;
margin-left: 1em;
}
color: color(gray, 800);
@media (prefers-color-scheme: dark) {
color: color(gray, 200);
}
font-family: $codeFont;
font-size: $fontSizeSmall;
}
.content {
margin: 0;
padding: 4em 0;
@media (max-width: $tablet) {
margin: 1em 0;
padding: 0 0 2em 0;
}
border-bottom: 1px solid color(gray, 100);
@media (prefers-color-scheme: dark) {
border-color: color(gray, 900);
}
*:first-child {
margin-top: 0;
}
img {
max-width: 100%;
height: auto;
border-radius: 12px;
border: 1px solid color(gray, 200);
@media (prefers-color-scheme: dark) {
border-color: color(gray, 800);
}
}
}
footer {
display: flex;
padding: 2em 0;
@media (max-width: $tablet) {
padding: 1em 0;
}
color: color(gray, 500);
justify-content: space-between;
border-top: 1px solid color(gray, 100);
@media (prefers-color-scheme: dark) {
border-color: color(gray, 900);
}
a {
margin-left: 1em;
color: color(gray, 500);
text-decoration: none;
&:hover {
color: color(gray, 500);
opacity: 0.6;
}
}
}

View File

@ -0,0 +1,29 @@
/* Dark mode colors. */
:root {
--sl-color-accent-low: #3a0e38;
--sl-color-accent: #ae00a8;
--sl-color-accent-high: #ebb4e5;
--sl-color-white: #ffffff;
--sl-color-gray-1: #e8edff;
--sl-color-gray-2: #bac1da;
--sl-color-gray-3: #7d89b8;
--sl-color-gray-4: #4b5580;
--sl-color-gray-5: #2c355d;
--sl-color-gray-6: #1c2349;
--sl-color-black: #131729;
}
/* Light mode colors. */
:root[data-theme='light'] {
--sl-color-accent-low: #f1c7ec;
--sl-color-accent: #b100ab;
--sl-color-accent-high: #550852;
--sl-color-white: #131729;
--sl-color-gray-1: #1c2349;
--sl-color-gray-2: #2c355d;
--sl-color-gray-3: #4b5580;
--sl-color-gray-4: #7d89b8;
--sl-color-gray-5: #bac1da;
--sl-color-gray-6: #e8edff;
--sl-color-gray-7: #f3f6ff;
--sl-color-black: #ffffff;
}

136
www/src/styles/type.scss Normal file
View File

@ -0,0 +1,136 @@
$baseFont: 'Lato', sans-serif;
$codeFont: 'Source Code Pro', monospace;
$fontSizeSmall: 15px;
body {
font-family: $baseFont;
font-size: 18px;
line-height: 1.65;
font-weight: 400;
@media (prefers-color-scheme: dark) {
color: color(gray, 200);
}
color: color(gray, 800);
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-rendering: optimizeLegibility;
}
h1,
h2,
h3,
h4,
h5 {
line-height: 1.2;
margin: 1em 0 0.5em 0;
@media (prefers-color-scheme: dark) {
color: $white;
}
color: color(gray, 950);
font-weight: 700;
}
h1 {
font-size: 3.052em;
}
h2 {
font-size: 2.441em;
}
h3 {
font-size: 1.953em;
}
h4 {
font-size: 1.563em;
}
h5 {
font-size: 1.25em;
}
p {
margin: 0 0 1em 0;
}
code {
font-family: $codeFont;
font-weight: bold;
color:rgb(0, 114, 114);
@media (prefers-color-scheme: dark) {
color: rgb(0, 231, 231);
}
}
.quickstart {
list-style: none inside;
margin-top: 4px;
font-size: medium;
width: fit-content;
color:rgb(82, 82, 82);
border: 2px solid #a0a0a0;
border-radius: 2rem;
background-color: #ffffff;
padding-left: 0.5rem;
padding-top: 0.5rem;
padding-bottom: 0.5rem;
padding-right: 0.5rem;
@media (prefers-color-scheme: dark) {
color: rgb(170, 170, 170);
border: 2px solid #1f1f1f;
background-color: #161616;
}
}
.qstart {
font-family: $codeFont;
font-weight: bold;
margin-top: 4px;
color:rgb(165, 0, 115);
padding-left: 0.5rem;
padding-right: 0.5rem;
@media (prefers-color-scheme: dark) {
color: rgb(255, 0, 179);
}
}
.install {
font-family: $codeFont;
font-weight: bold;
margin-top: 4px;
color:rgb(0, 161, 161);
border: 2px solid #a7a7a7;
border-radius: 2rem;
padding-left: 0.5rem;
padding-right: 0.5rem;
background-color: #eeeeee;
@media (prefers-color-scheme: dark) {
color: rgb(0, 231, 231);
border: 2px solid #6e6e6e;
background-color: #2e2e2e;
}
}
.comment {
font-family: $codeFont;
font-weight: bold;
margin-top: 4px;
color:rgb(102, 102, 102);
border: 2px solid #929292;
border-radius: 2rem;
padding-left: 0.5rem;
padding-right: 0.5rem;
background-color: #dddddd;
@media (prefers-color-scheme: dark) {
color: rgb(170, 170, 170);
border: 2px solid #4b4b4b;
background-color: #2e2e2e;
}
}
b,
strong {
font-weight: 700;
color: #fff;
@media (prefers-color-scheme: dark) {
color: $white;
}
color: color(gray, 950);
}

4
www/tsconfig.json Normal file
View File

@ -0,0 +1,4 @@
{
"extends": "astro/tsconfigs/strict",
"exclude": ["dist"]
}