sc0ttj / mdsh

A simple static site generator, using Markdown and Bash
https://sc0ttj.github.io/mdsh/
10 stars 0 forks source link

Partial rebuilds #77

Closed sc0ttj closed 5 years ago

sc0ttj commented 5 years ago

Partial rebuilds

Description: Faster site rebuilds after creating a post

By "partial" rebuilds, it means only rebuilding the necessary files. For example, a user creates a new post, called "my-cool-post", with this meta info:

- category: blog
- author: bob
- tags: shell, markdown
- year: 2019
- month: 03

With partial rebuilds, only some pages wil be rebuilt after creating a post:

Updating: index.html 
Updating: posts/2019/index.html 
Updating: posts/2019/03/index.html 
Updating: archive.html 
Updating: authors/index.html
Updating: authors/bob.html
Updating: categories/index.html
Updating: categories/blog.html
Updating: search.html 
Updating: tags/index.html
Updating: tags/shell.html
Updating: tags/markdown.html

Minifying CSS...

Finished.

^ the partial rebuild ignored lots of pages (yearly/monthly indexes, author, categories and tags pages) that are unaffected by the new post.

Cached content

During a rebuild, the following page areas are cached, as they do not change page to page:

This speeds up rebuilds, as the site header, site footer and site navigation are generated from template only once, when building the first page, and thereafter they are simply copied from tmp files.

Fixed onwards journeys

The prev/next links chosen when building a post have been fixed - they now exclude disabled (commented out) posts, as they should.

Fixed new post routine

When creating a new post, the previous post is also updated so that the new post is included in it's "Next page" onward journey. This remove the need to manually rebuild the previous post after adding a new one.

Fix help output

Fixes a couple of outdated help messages: changed $() to <?bash ... ;?>

Not yet implemented:

rebuild a group of index pages

- `rebuild 2019` => rebuild all monthly index pages in posts/2019/
- `rebuild authors` => rebuild all author pages
- `rebuild categories` => rebuild all category pages
- `rebuild tags` => rebuild all tag pages

rebuild a specific index page:

- `rebuild 2019/03` => rebuilds 2019/03/index.html
- `rebuild authors/bob` => rebuilds authors/bob.html
- `rebuild categories/blog` => rebuilds categories/blog.html
- `rebuild tags/markdown` => rebuilds tags/markdown.html