This commit is contained in:
array-in-a-matrix 2024-01-11 20:29:15 -05:00
parent eaf30ffc48
commit 989a81295b

View file

@ -1,68 +1,39 @@
# Astro Starter Kit: Blog
# Blog in a Matrix
New blog site using [Astro](https://astro.build/).
---
## Workflow
Articles are written in markdown or MDX (I am using [Joplin](https://github.com/laurent22/joplin/)) then exported to `/src/content/blog`. The site can render [$\KaTeX$](https://katex.org/) and [Mermaid](https://mermaid.js.org/) content.
## Development
### Setup
Install dependencies:
```sh
npm create astro@latest -- --template blog
pnpm import
```
[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/withastro/astro/tree/latest/examples/blog)
[![Open with CodeSandbox](https://assets.codesandbox.io/github/button-edit-lime.svg)](https://codesandbox.io/p/sandbox/github/withastro/astro/tree/latest/examples/blog)
[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/withastro/astro?devcontainer_path=.devcontainer/blog/devcontainer.json)
### Dev Server
> 🧑‍🚀 **Seasoned astronaut?** Delete this file. Have fun!
Start a development server using the following command:
![blog](https://github.com/withastro/astro/assets/2244813/ff10799f-a816-4703-b967-c78997e8323d)
Features:
- ✅ Minimal styling (make it your own!)
- ✅ 100/100 Lighthouse performance
- ✅ SEO-friendly with canonical URLs and OpenGraph data
- ✅ Sitemap support
- ✅ RSS Feed support
- ✅ Markdown & MDX support
## 🚀 Project Structure
Inside of your Astro project, you'll see the following folders and files:
```text
├── public/
├── src/
│   ├── components/
│   ├── content/
│   ├── layouts/
│   └── pages/
├── astro.config.mjs
├── README.md
├── package.json
└── tsconfig.json
```sh
pnpm dev --open --host
```
Astro looks for `.astro`, `.md` and `.mdx` files in the `src/pages/` directory. Each page is exposed as a route based on its file name.
The site should be now accessible at [http://localhost:4321/](http://localhost:4321/). A specific port can be specified using `--port` flag.
There's nothing special about `src/components/`, but that's where we like to put any Astro/React/Vue/Svelte/Preact components.
### Build
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.
Build deployable site:
Any static assets, like images, can be placed in the `public/` directory.
```sh
pnpm astro build
```
## 🧞 Commands
All commands are run from the root of the project, from a terminal:
| Command | Action |
| :------------------------ | :----------------------------------------------- |
| `npm install` | Installs dependencies |
| `npm run dev` | Starts local dev server at `localhost:4321` |
| `npm run build` | Build your production site to `./dist/` |
| `npm run preview` | Preview your build locally, before deploying |
| `npm run astro ...` | Run CLI commands like `astro add`, `astro check` |
| `npm run astro -- --help` | Get help using the Astro CLI |
## 👀 Want to learn more?
Check out [our documentation](https://docs.astro.build).
## Credit
This theme is based off of the lovely [Bear Blog](https://github.com/HermanMartinus/bearblog/).
Built site can now be found at `/dist`.