Skip to content

Commit 80be1a3

Browse files
committed
update opensaas blog READMEs
1 parent a436c1b commit 80be1a3

File tree

3 files changed

+146
-39
lines changed

3 files changed

+146
-39
lines changed

opensaas-sh/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ Make sure not to commit `app/` to git. It is currently (until we resolve this) n
4444

4545
Blog (and docs in it) is currently tracked in whole, as it has quite some content, so updating it to the latest version of Open Saas is done manually, but it might be interesting to also move it to the `diff` approach, as we use for the demo app, if it turns out to be a good match.
4646

47+
For more info on authoring content for the docs and blog, including information on custom components, see the [blog/README.md](blog/README.md).
48+
4749
## Deployment
4850

4951
App: check its README.md (after you generate it with `.tools/patch.sh`) .

opensaas-sh/blog/README.md

Lines changed: 142 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,7 @@
1-
# Starlight Starter Kit: Basics
1+
# OpenSaaS Docs and Blog
22

3-
[![Built with Starlight](https://astro.badg.es/v2/built-with-starlight/tiny.svg)](https://starlight.astro.build)
3+
This is the docs and blog for the OpenSaaS.sh website, [![Built with Starlight](https://astro.badg.es/v2/built-with-starlight/tiny.svg)](https://starlight.astro.build)
44

5-
```
6-
npm create astro@latest -- --template starlight
7-
```
8-
9-
[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/withastro/starlight/tree/main/examples/basics)
10-
[![Open with CodeSandbox](https://assets.codesandbox.io/github/button-edit-lime.svg)](https://codesandbox.io/p/sandbox/github/withastro/starlight/tree/main/examples/basics)
11-
12-
> 🧑‍🚀 **Seasoned astronaut?** Delete this file. Have fun!
135

146
## 🚀 Project Structure
157

@@ -20,8 +12,12 @@ Inside of your Astro + Starlight project, you'll see the following folders and f
2012
├── public/
2113
├── src/
2214
│ ├── assets/
15+
│ ├── components/
2316
│ ├── content/
2417
│ │ ├── docs/
18+
│ │ │ ├── blog/
19+
│ │ │ ├── guides/
20+
│ │ │ └── ...
2521
│ │ └── config.ts
2622
│ └── env.d.ts
2723
├── astro.config.mjs
@@ -31,23 +27,146 @@ Inside of your Astro + Starlight project, you'll see the following folders and f
3127

3228
Starlight looks for `.md` or `.mdx` files in the `src/content/docs/` directory. Each file is exposed as a route based on its file name.
3329

30+
Blog posts are in the `src/content/docs/blog/` directory. Use `.mdx` files for blog posts.
31+
3432
Images can be added to `src/assets/` and embedded in Markdown with a relative link.
3533

36-
Static assets, like favicons, can be placed in the `public/` directory.
34+
Static assets, like favicons and banner images, can be placed in the `public/` directory.
35+
36+
We have a number of custom components in `src/components/` that you can use in your blog posts and docs.
37+
38+
## Custom Components
39+
40+
Custom components in the `src/components/` that replace default Starlight components are imported into the `astro.config.mjs` file:
41+
42+
```js
43+
components: {
44+
SiteTitle: './src/components/MyHeader.astro',
45+
ThemeSelect: './src/components/MyThemeSelect.astro',
46+
Head: './src/components/HeadWithOGImage.astro',
47+
PageTitle: './src/components/TitleWithBannerImage.astro',
48+
},
49+
```
50+
51+
Other components can be imported into your blog posts and docs using the `import` statement:
52+
53+
```mdx
54+
---
55+
title: "Open SaaS Tutorial"
56+
date: 2024-12-10
57+
//...
58+
---
59+
import VideoPlayer from '../../../components/VideoPlayer.astro';
60+
```
61+
62+
### HeadWithOGImage
63+
64+
This component is used to generate the Open Graph (OG) meta tags for the social media preview images for each doc and blog post.
65+
66+
It checks if a banner image exists in `./public/banner-images` with the same name as the blog post but with a `.webp` extension, e.g. if the blog post is `2024-12-10-open-saas-tutorial.mdx`, it checks for `./public/banner-images/2024-12-10-open-saas-tutorial.webp`. If it does, it uses that image. If it doesn't, it uses the default banner image.
67+
68+
Generally, the default banner image is used for docs, and blog posts use a custom banner image.
69+
70+
### TitleWithBannerImage
71+
72+
This component uses the same image as the `HeadWithOGImage` component to display a banner image above the title of the blog post.
73+
74+
You can use the `hideBannerImage` prop to hide the banner image on the page:
75+
76+
```mdx
77+
---
78+
title: "Open SaaS Tutorial"
79+
date: 2024-12-10
80+
hideBannerImage: true
81+
---
82+
```
83+
84+
Because the same image in `./public/banner-images` is used for social media preview images and the banner image on the doc/blog page, `hideBannerImage: true` will hide the banner image on the doc/blog page, but still use that image for the social media preview image.
85+
86+
### VideoPlayer
87+
88+
This component is a wrapper around the `video` element that adds some default styles.
3789

38-
## 🧞 Commands
90+
You can pass three props to the component:
3991

40-
All commands are run from the root of the project, from a terminal:
92+
- `src` (required): the path to the video file
93+
- `lgWidth` (optional): the width of the video player on large screens greater than 425px. If no prop is passed the default is `55%`.
94+
- `smWidth` (optional): the width of the video player on small screens less than 425px. If no prop is passed the default is `100%`.
95+
96+
```mdx
97+
---
98+
title: "Open SaaS Tutorial"
99+
date: 2024-12-10
100+
//...
101+
---
102+
import VideoPlayer from '../../../components/VideoPlayer.astro';
103+
104+
<VideoPlayer src="/videos/open-saas-tutorial.mp4" lgWidth="75%" smWidth="80%" />
105+
```
106+
107+
### MyHeader
108+
109+
This component is a wrapper around the `Header` component from the `@astrojs/starlight` package.
110+
111+
It repositions the docs and blog links to the left, and adds a logo and a link to the home page, https://opensaas.sh.
112+
113+
114+
## Authoring Content
115+
116+
The docs and blog are written in Markdown or MDX with some additional metadata:
117+
118+
```mdx
119+
title: We Made the Most Annoying Cookie Banners Ever
120+
date: 2024-11-26
121+
tags:
122+
- cookie consent
123+
- saas
124+
- sideproject
125+
- hackathon
126+
subtitle: and it was totally worth it
127+
hideBannerImage: true
128+
authors: vince
129+
```
130+
131+
Most posts are written in MDX, which allows you to use jsx components in your blog posts. It's recommended to use the MDX extension for your editor, such as this one for [VSCode](https://marketplace.cursorapi.com/items?itemName=unifiedjs.vscode-mdx).
132+
133+
### Blog Post Metadata
134+
`authors` is required and will display the authors of the blog post. To configure a new author, add the proper metadata to `astro.config.mjs` under plugins > starlightBlog > authors:
135+
136+
```js
137+
authors: {
138+
vince: {
139+
name: 'Vince',
140+
title: 'Dev Rel @ Wasp',
141+
picture: '/CRAIG_ROCK.png', // Put author images in the `public` directory.
142+
url: 'https://wasp-lang.dev',
143+
},
144+
},
145+
```
146+
147+
`subtitle` is optional and will display a subtitle below the title of the blog post.
148+
149+
`hideBannerImage` is optional and will hide the banner image in `./public/banner-images` on the blog post page if you only want it to be displayed as the social media preview image (remember, the same image is used for both the social media preview image and the banner image on the blog post page).
150+
151+
### Images
152+
153+
Images to be used in guides and posts are stored in `./src/assets` and are referenced in the blog posts with a relative path.
154+
155+
Banner images used for social media preview images, as well as cover images for blog posts, are stored in `./public/banner-images` and must always use the `.webp` extension. If a banner image is not found, the default banner image is used. (Note: banner images for docs are used only for social media preview images, where for blog posts the are used as social media preview images and as cover images on the blog post page unless the `hideBannerImage` metadata is set to `true`.)
156+
157+
See the [HeadWithOGImage](#headwithogimage) and [TitleWithBannerImage](#titlewithbannerimage) sections for more information.
158+
159+
Always use astro's `Image` component to embed images in your blog posts and docs as Astro will automatically optimize the images for the web.
160+
161+
```mdx
162+
import { Image } from 'astro:assets';
163+
import myImage from '../../../assets/my-image.jpg';
164+
165+
<Image src={myImage} alt="My Image" />
166+
```
41167

42-
| Command | Action |
43-
| :------------------------ | :----------------------------------------------- |
44-
| `npm install` | Installs dependencies |
45-
| `npm run dev` | Starts local dev server at `localhost:4321` |
46-
| `npm run build` | Build your production site to `./dist/` |
47-
| `npm run preview` | Preview your build locally, before deploying |
48-
| `npm run astro ...` | Run CLI commands like `astro add`, `astro check` |
49-
| `npm run astro -- --help` | Get help using the Astro CLI |
168+
## Video
50169

51-
## 👀 Want to learn more?
170+
Videos to be used in blog posts are stored in `./src/assets/` and are referenced in the blog posts with a relative path, just like images.
52171

53-
Check out [Starlight’s docs](https://starlight.astro.build/), read [the Astro documentation](https://docs.astro.build), or jump into the [Astro Discord server](https://astro.build/chat).
172+
Always use the `VideoPlayer` component to embed videos in your blog posts. See the [VideoPlayer component](#videoplayer) section for more information.

opensaas-sh/blog/astro.config.mjs

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -69,25 +69,11 @@ export default defineConfig({
6969
},
7070
{
7171
label: 'Guides',
72-
items: [
73-
{ label: 'Authentication', link: '/guides/authentication/' },
74-
{ label: 'Authorization', link: '/guides/authorization/' },
75-
{ label: 'Payments Integration', link: '/guides/payments-integration/' },
76-
{ label: 'Analytics', link: '/guides/analytics/' },
77-
{ label: 'SEO', link: '/guides/seo/' },
78-
{ label: 'Email Sending', link: '/guides/email-sending/' },
79-
{ label: 'File Uploading', link: '/guides/file-uploading/' },
80-
{ label: 'Cookie Consent', link: '/guides/cookie-consent/' },
81-
{ label: 'Tests', link: '/guides/tests/' },
82-
{ label: 'Deploying', link: '/guides/deploying/' },
83-
],
72+
autogenerate: { directory: '/guides/' },
8473
},
8574
{
8675
label: 'General',
87-
items: [
88-
{ label: 'Admin Dashboard', link: '/general/admin-dashboard/' },
89-
{ label: 'User Overview', link: '/general/user-overview/' },
90-
],
76+
autogenerate: { directory: '/general/' },
9177
},
9278
],
9379
plugins: [

0 commit comments

Comments
 (0)