Implement styling, easier config
This commit is contained in:
38
README.md
38
README.md
@@ -34,7 +34,7 @@ npm run dev
|
||||
## How Content Works
|
||||
|
||||
- Each top-level folder inside `src/content/` is a content section.
|
||||
- The current site includes one section: `src/content/website/`.
|
||||
- The current site includes sections for `src/content/website/` and `src/content/avatar-items/`.
|
||||
- Files in a section can be `.md` or `.mdx`.
|
||||
- Each content file must include frontmatter with:
|
||||
|
||||
@@ -80,7 +80,7 @@ This page will be available at:
|
||||
|
||||
## Adding A New Content Section
|
||||
|
||||
If you want a new group of subpages, create a new folder in `src/content/` and then register it in config.
|
||||
If you want a new group of subpages, create a new folder in `src/content/` and then register it once in `src/config/content.ts`.
|
||||
|
||||
### 1. Create the folder and files
|
||||
|
||||
@@ -94,31 +94,27 @@ src/content/mobile-app/
|
||||
|
||||
`index.mdx` should describe the section landing page. Any additional files become subpages for that section.
|
||||
|
||||
### 2. Update `src/content.config.ts`
|
||||
### 2. Update `src/config/content.ts`
|
||||
|
||||
Add a collection for the new folder and export it:
|
||||
Add a new entry to `contentSections`:
|
||||
|
||||
```ts
|
||||
const mobileApp = defineCollection({
|
||||
loader: glob({ base: "./src/content/mobile-app", pattern: "**/*.{md,mdx}" }),
|
||||
schema: articleSchema,
|
||||
});
|
||||
|
||||
export const collections = {
|
||||
website,
|
||||
mobileApp,
|
||||
export const contentSections = {
|
||||
website: {
|
||||
dir: "website",
|
||||
},
|
||||
avatarItems: {
|
||||
dir: "avatar-items",
|
||||
},
|
||||
mobileApp: {
|
||||
dir: "mobile-app",
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
### 3. Update `src/config/content.ts`
|
||||
The object key is the section route and Astro collection name. The `dir` value is the folder under `src/content/`.
|
||||
|
||||
Add the new collection name so routing and navigation include it:
|
||||
|
||||
```ts
|
||||
export const collectionNames = ["website", "mobileApp"] as const;
|
||||
```
|
||||
|
||||
### 4. Run the site locally
|
||||
### 3. Run the site locally
|
||||
|
||||
```sh
|
||||
npm run dev
|
||||
@@ -135,4 +131,4 @@ Verify that:
|
||||
- Keep one topic per file.
|
||||
- Use `index.mdx` only for a section landing page.
|
||||
- Prefer lowercase, hyphenated filenames for clean URLs.
|
||||
- If you create a new top-level content folder, update both `src/content.config.ts` and `src/config/content.ts`.
|
||||
- If you create a new top-level content folder, register it in `src/config/content.ts`. `src/content.config.ts`, navigation, and routing derive from that registry.
|
||||
|
||||
Reference in New Issue
Block a user