Back

Local Filesystem Demo

LO
Updated by local on October 20, 2018
|Local file

Local Filesystem Demo

This article is served directly from the local filesystem using simple-git to extract commit metadata.

How It Works

The LocalFsDataProvider reads markdown files from a directory and uses git to get:

  • Last modified date - from the most recent commit
  • Author name - from the commit author
  • File history - tracked via git SHA

Use Cases

Use CaseBenefit
Local developmentPreview posts before pushing
Static site generationBuild at deploy time
Self-hosted blogsNo GitHub API dependency
Offline editingWrite anywhere

Quick Start

import { LocalFsDataProvider } from 'madea-blog-core/providers/local-fs';

const provider = new LocalFsDataProvider({
  contentDir: './posts',
  authorName: 'Your Name',
});

const articles = await provider.getArticleList();
const article = await provider.getArticle('hello-world.md');

Task List

  • Create LocalFsDataProvider
  • Integrate simple-git for metadata
  • Add /local demo route
  • Write documentation

Learn More


"The best way to predict the future is to invent it." — Alan Kay