Skip to content

Commit 7c69d23

Browse files
feugytobiaslins
andauthored
feat: Astro support (#29)
Co-authored-by: Tobias Lins <[email protected]>
1 parent 45df4f1 commit 7c69d23

28 files changed

+5532
-7932
lines changed

.prettierignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ dist/
33
.github/
44
.nuxt/
55
.svelte-kit/
6-
.vercel/
6+
.vercel/
7+
pnpm-lock.yaml

apps/astro/.gitignore

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# build output
2+
dist/
3+
# generated types
4+
.astro/
5+
6+
# dependencies
7+
node_modules/
8+
9+
# logs
10+
npm-debug.log*
11+
yarn-debug.log*
12+
yarn-error.log*
13+
pnpm-debug.log*
14+
15+
16+
# environment variables
17+
.env
18+
.env.production
19+
20+
# macOS-specific files
21+
.DS_Store

apps/astro/README.md

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# Astro Starter Kit: Blog
2+
3+
```sh
4+
npm create astro@latest -- --template blog
5+
```
6+
7+
[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/withastro/astro/tree/latest/examples/blog)
8+
[![Open with CodeSandbox](https://assets.codesandbox.io/github/button-edit-lime.svg)](https://codesandbox.io/p/sandbox/github/withastro/astro/tree/latest/examples/blog)
9+
[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/withastro/astro?devcontainer_path=.devcontainer/blog/devcontainer.json)
10+
11+
> 🧑‍🚀 **Seasoned astronaut?** Delete this file. Have fun!
12+
13+
![blog](https://github.com/withastro/astro/assets/2244813/ff10799f-a816-4703-b967-c78997e8323d)
14+
15+
Features:
16+
17+
- ✅ Minimal styling (make it your own!)
18+
- ✅ 100/100 Lighthouse performance
19+
- ✅ SEO-friendly with canonical URLs and OpenGraph data
20+
- ✅ Sitemap support
21+
- ✅ RSS Feed support
22+
- ✅ Markdown & MDX support
23+
24+
## 🚀 Project Structure
25+
26+
Inside of your Astro project, you'll see the following folders and files:
27+
28+
```text
29+
├── public/
30+
├── src/
31+
│   ├── components/
32+
│   ├── content/
33+
│   ├── layouts/
34+
│   └── pages/
35+
├── astro.config.mjs
36+
├── README.md
37+
├── package.json
38+
└── tsconfig.json
39+
```
40+
41+
Astro looks for `.astro` or `.md` files in the `src/pages/` directory. Each page is exposed as a route based on its file name.
42+
43+
There's nothing special about `src/components/`, but that's where we like to put any Astro/React/Vue/Svelte/Preact components.
44+
45+
The `src/content/` directory contains "collections" of related Markdown and MDX documents. Use `getCollection()` to retrieve posts from `src/content/blog/`, and type-check your frontmatter using an optional schema. See [Astro's Content Collections docs](https://docs.astro.build/en/guides/content-collections/) to learn more.
46+
47+
Any static assets, like images, can be placed in the `public/` directory.
48+
49+
## 🧞 Commands
50+
51+
All commands are run from the root of the project, from a terminal:
52+
53+
| Command | Action |
54+
| :------------------------ | :----------------------------------------------- |
55+
| `npm install` | Installs dependencies |
56+
| `npm run dev` | Starts local dev server at `localhost:4321` |
57+
| `npm run build` | Build your production site to `./dist/` |
58+
| `npm run preview` | Preview your build locally, before deploying |
59+
| `npm run astro ...` | Run CLI commands like `astro add`, `astro check` |
60+
| `npm run astro -- --help` | Get help using the Astro CLI |
61+
62+
## 👀 Want to learn more?
63+
64+
Check out [our documentation](https://docs.astro.build) or jump into our [Discord server](https://astro.build/chat).
65+
66+
## Credit
67+
68+
This theme is based off of the lovely [Bear Blog](https://github.com/HermanMartinus/bearblog/).

apps/astro/astro.config.mjs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { defineConfig } from 'astro/config';
2+
import mdx from '@astrojs/mdx';
3+
4+
import sitemap from '@astrojs/sitemap';
5+
6+
// https://astro.build/config
7+
export default defineConfig({
8+
site: 'https://example.com',
9+
integrations: [mdx(), sitemap()],
10+
});

apps/astro/package.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"name": "astro",
3+
"version": "0.0.1",
4+
"type": "module",
5+
"scripts": {
6+
"astro": "astro",
7+
"build": "astro build",
8+
"dev": "astro dev",
9+
"preview": "astro preview",
10+
"start": "astro dev"
11+
},
12+
"dependencies": {
13+
"@astrojs/mdx": "^2.0.1",
14+
"@astrojs/rss": "^4.0.1",
15+
"@astrojs/sitemap": "^3.0.3",
16+
"@vercel/speed-insights": "workspace:*",
17+
"astro": "^4.0.4"
18+
}
19+
}

apps/astro/public/favicon.svg

Lines changed: 9 additions & 0 deletions
Loading
23.2 KB
Binary file not shown.
22.3 KB
Binary file not shown.
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
---
2+
// Import the global.css file here so that it is included on
3+
// all pages through the use of the <BaseHead /> component.
4+
import '../styles/global.css';
5+
import SpeedInsights from '@vercel/speed-insights/astro';
6+
7+
interface Props {
8+
title: string;
9+
description: string;
10+
image?: string;
11+
}
12+
13+
const canonicalURL = new URL(Astro.url.pathname, Astro.site);
14+
15+
const { title, description } = Astro.props;
16+
---
17+
18+
<!-- Global Metadata -->
19+
<meta charset="utf-8" />
20+
<meta name="viewport" content="width=device-width,initial-scale=1" />
21+
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
22+
<meta name="generator" content={Astro.generator} />
23+
24+
<!-- Font preloads -->
25+
<link
26+
rel="preload"
27+
href="/fonts/atkinson-regular.woff"
28+
as="font"
29+
type="font/woff"
30+
crossorigin
31+
/>
32+
<link
33+
rel="preload"
34+
href="/fonts/atkinson-bold.woff"
35+
as="font"
36+
type="font/woff"
37+
crossorigin
38+
/>
39+
40+
<!-- Canonical URL -->
41+
<link rel="canonical" href={canonicalURL} />
42+
43+
<!-- Primary Meta Tags -->
44+
<title>{title}</title>
45+
<meta name="title" content={title} />
46+
<meta name="description" content={description} />
47+
48+
<script is:inline>
49+
function speedInsightsBeforeSend(data){
50+
console.log("Speed Insights before send", data)
51+
return data;
52+
}
53+
</script>
54+
55+
<SpeedInsights />
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
interface Props {
3+
date: Date;
4+
}
5+
6+
const { date } = Astro.props;
7+
---
8+
9+
<time datetime={date.toISOString()}>
10+
{
11+
date.toLocaleDateString('en-us', {
12+
year: 'numeric',
13+
month: 'short',
14+
day: 'numeric',
15+
})
16+
}
17+
</time>

0 commit comments

Comments
 (0)