Source content from Obsidian vault via CONTENT_BASE env var
Locally: reads from /Users/neeldhara/gitea/obsidian/public/blogs/micro (via .env) CI: reads from ./src/content (snapshot committed to repo) Amp-Thread-ID: https://ampcode.com/threads/T-019c7839-0936-729b-aa87-92b35d3d68fe Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
parent
f5ea28ef66
commit
c32a14ce5a
4 changed files with 16 additions and 4 deletions
|
|
@ -1,8 +1,12 @@
|
|||
import { defineCollection, z } from "astro:content";
|
||||
import { glob } from 'astro/loaders';
|
||||
import { loadEnv } from "vite";
|
||||
|
||||
const { CONTENT_BASE } = loadEnv(process.env.NODE_ENV ?? "", process.cwd(), "");
|
||||
const contentBase = CONTENT_BASE || "./src/content";
|
||||
|
||||
const blog = defineCollection({
|
||||
loader: glob({ pattern: '**/*.{md,mdx}', base: "./src/content/blog" }),
|
||||
loader: glob({ pattern: '**/*.{md,mdx}', base: `${contentBase}/blog` }),
|
||||
schema: z.object({
|
||||
title: z.string(),
|
||||
description: z.string(),
|
||||
|
|
@ -13,7 +17,7 @@ const blog = defineCollection({
|
|||
});
|
||||
|
||||
const projects = defineCollection({
|
||||
loader: glob({ pattern: '**/*.{md,mdx}', base: "./src/content/projects" }),
|
||||
loader: glob({ pattern: '**/*.{md,mdx}', base: `${contentBase}/projects` }),
|
||||
schema: z.object({
|
||||
title: z.string(),
|
||||
description: z.string(),
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ date: '2024-03-22'
|
|||
tags:
|
||||
- tutorial
|
||||
---
|
||||
|
||||
---
|
||||
|
||||
## Install astro-micro
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue