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
|
cache: npm
|
||||||
|
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
- run: npm run build
|
- name: Build
|
||||||
|
run: npm run build
|
||||||
|
env:
|
||||||
|
CONTENT_BASE: ./src/content
|
||||||
|
|
||||||
- name: Deploy to Netlify
|
- name: Deploy to Netlify
|
||||||
uses: nwtgck/actions-netlify@v3
|
uses: nwtgck/actions-netlify@v3
|
||||||
|
|
|
||||||
6
.gitignore
vendored
6
.gitignore
vendored
|
|
@ -1,5 +1,8 @@
|
||||||
# build output
|
# build output
|
||||||
dist/
|
dist/
|
||||||
|
|
||||||
|
# local env
|
||||||
|
.env
|
||||||
# generated types
|
# generated types
|
||||||
.astro/
|
.astro/
|
||||||
|
|
||||||
|
|
@ -22,3 +25,6 @@ pnpm-debug.log*
|
||||||
|
|
||||||
# jetbrains setting folder
|
# jetbrains setting folder
|
||||||
.idea/
|
.idea/
|
||||||
|
|
||||||
|
# Local Netlify folder
|
||||||
|
.netlify
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,12 @@
|
||||||
import { defineCollection, z } from "astro:content";
|
import { defineCollection, z } from "astro:content";
|
||||||
import { glob } from 'astro/loaders';
|
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({
|
const blog = defineCollection({
|
||||||
loader: glob({ pattern: '**/*.{md,mdx}', base: "./src/content/blog" }),
|
loader: glob({ pattern: '**/*.{md,mdx}', base: `${contentBase}/blog` }),
|
||||||
schema: z.object({
|
schema: z.object({
|
||||||
title: z.string(),
|
title: z.string(),
|
||||||
description: z.string(),
|
description: z.string(),
|
||||||
|
|
@ -13,7 +17,7 @@ const blog = defineCollection({
|
||||||
});
|
});
|
||||||
|
|
||||||
const projects = defineCollection({
|
const projects = defineCollection({
|
||||||
loader: glob({ pattern: '**/*.{md,mdx}', base: "./src/content/projects" }),
|
loader: glob({ pattern: '**/*.{md,mdx}', base: `${contentBase}/projects` }),
|
||||||
schema: z.object({
|
schema: z.object({
|
||||||
title: z.string(),
|
title: z.string(),
|
||||||
description: z.string(),
|
description: z.string(),
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@ date: '2024-03-22'
|
||||||
tags:
|
tags:
|
||||||
- tutorial
|
- tutorial
|
||||||
---
|
---
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Install astro-micro
|
## Install astro-micro
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue