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
|
|
@ -16,7 +16,10 @@ jobs:
|
|||
cache: npm
|
||||
|
||||
- run: npm ci
|
||||
- run: npm run build
|
||||
- name: Build
|
||||
run: npm run build
|
||||
env:
|
||||
CONTENT_BASE: ./src/content
|
||||
|
||||
- name: Deploy to Netlify
|
||||
uses: nwtgck/actions-netlify@v3
|
||||
|
|
|
|||
6
.gitignore
vendored
6
.gitignore
vendored
|
|
@ -1,5 +1,8 @@
|
|||
# build output
|
||||
dist/
|
||||
|
||||
# local env
|
||||
.env
|
||||
# generated types
|
||||
.astro/
|
||||
|
||||
|
|
@ -22,3 +25,6 @@ pnpm-debug.log*
|
|||
|
||||
# jetbrains setting folder
|
||||
.idea/
|
||||
|
||||
# Local Netlify folder
|
||||
.netlify
|
||||
|
|
|
|||
|
|
@ -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