#markdown #blog #static #site

bin+lib onepage

A simple static site generator

9 releases

Uses new Rust 2021

0.1.8 Apr 29, 2022
0.1.7 Apr 19, 2022
0.1.4 Mar 30, 2022

#452 in Text processing

MIT license

1MB
2K SLoC

JavaScript 1.5K SLoC // 0.0% comments Rust 877 SLoC // 0.0% comments

ONEPAGE

Overview

A simple static site genertor, convert md posts to html.

Online demo

My blog

Usage

from repo

  • clone this repo, and:
  • cargo run -- build to build pages
  • cargo run -- serve to build pages, and make a server at localhost

from cargo

  • cargo install onepage
  • onepage init [dir] : download template files from github
  • onepage serve
  • onepage build
  • onepage new {filename}: create new post

Structure

  • /pages: markdown source file
    • index.md => index page
    • /posts/*.md => post page
    • /image images used in markdown file
  • /dist: generated site
  • /static: static resources
    • /assets: img/css/font
    • /favicon favicon files
  • /templates: html templates
  • /src: rust src

New post

  • make a .md file in /pages/posts/
  • you can copy from demo md files
  • at present, post page must have a fontmatter header, including title(required),date(required),tags(optional)
  • or you can use onepage new {filename} to create new post.
---
title: hello world
date: 2020-03-15 10:54:39
---
---
title: hello world
date: 2020-03-15 10:54:39
tags:
  - awesome-tag
  - more-awesome-tag
---

Todo

  • custom site config file (maybe not)
  • generate new page
  • live reload
  • site initialize to new path
  • css style
  • add command line
  • serve /dist
  • watch /pages and rebuild

reference

Dependencies

~22–32MB
~620K SLoC