Skip to content

carsonjones/astro-markdown-vault

Repository files navigation

Astro Markdown Vault

An Astro template for creating posts from local markdown files in another project.

Isolate your content from your website code. Use file-first tools for writing your content, like (Obsidian, iA Writer).

Setup

Copy the .env.example file as .env and add your variables.

VAR Action
CONTENT_DIR Location of your notes / content
POSTS_DIR Location of copied collection, synced with your content
WATCH_INTERVAL_MINUTES Minutes for background sync (explained below)

Commands

Command Action
bun install Install dependencies
bun dev Runs Astro server on http://localhost:4321
bun content:dev Syncs content on changes for local dev
bun content:copy Copy from your vault to site
bun content:assets Copy images from your vault to site
bun content:watch Start background watch + sync service

Background Sync + Publish

On the go? Within any file in your content directory, simply add the following front matter at the top of your markdown file.

---
title: Title of Post
slug: url-for-post
published: true
---

If you are running the bun content:watch process locally, this will:

  • look for any changes to files with this front matter (markdown only)
  • commit and push to main branch

Local Publish

If you want to control when to publish, simply run the bun content:sync command.

References

About

Sync local notes to Astro site in separate project

Resources

License

Stars

Watchers

Forks