Skip to content
aelobdogPublic

About

lih2 is a simple blog creation and maintanance tool

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

16 Commits

Folders and files

Repository files navigation

lih2

lih2 is a simple blog creation and maintanance tool

Setting up

Before you can make your blog, you need to get the necessary tools

$ # make a new directory to store the script and the blog
$ mkdir blog_cover

$ # change directories into the one you just created
$ cd blog_cover

$ # download lih.sh into the directory make it executable
$ wget https://raw.githubusercontent.com/aelobdog/lih2/master/lih.sh && chmod +x lih.sh

lih.sh needs the wrang markup compiler to build the site. If wrang is not on your PATH, make downloads the latest release binary from https://github.com/aelobdog/wrang/releases into ~/.local/bin/ (using curl or wget). Make sure ~/.local/bin is on your PATH:

$ export PATH="$HOME/.local/bin:$PATH"

Set LIH_NO_WRANG_INSTALL=1 to disable the auto-install.

serve needs python3. Post editing uses $EDITOR (default vim).

Making a new blog

Making the blog is a single command away now.

$ ./lih.sh init my_blog_name

This creates my_blog_name/{posts,composts,drafts}, a blog.conf with the blog title, and a minimal ./stylesheet.css (only if you don't have one yet). The [blog-name] argument is optional everywhere: when omitted, the basename of the current directory is used.

Writing your first post

Writing a post is simple as well!

$ ./lih.sh new my_blog_name
POST TITLE: My first post
<this opens $EDITOR; if it is missing, edit the file manually>

Drafts

Pass --draft to keep a post out of the published site until ready:

$ ./lih.sh new my_blog_name --draft
$ ./lih.sh list my_blog_name        # posts and drafts, newest first
$ ./lih.sh publish my_blog_name my-first   # move a draft to posts

Editing, listing and deleting

$ ./lih.sh edit my_blog_name my-first    # open the match in $EDITOR
$ ./lih.sh rm my_blog_name my-first      # delete (asks [y/N] first)

Patterns match post filenames as fixed strings. Ambiguous patterns list the candidates instead of guessing.

Configuring the blog

my_blog_name/blog.conf holds plain shell assignments:

BLOG_TITLE='my_blog_name'
BLOG_AUTHOR=''
BLOG_DESCRIPTION=''
BLOG_URL=''   # site root, e.g. https://example.com (used for feed links)

Generating the blog

Now that the post is written, run the following command to generate the blog index, all the posts and the RSS feed.

$ ./lih.sh make my_blog_name

This compiles posts/ to my_blog_name/composts/, prunes output files whose post was deleted, writes index.html and feed.xml (latest 20 posts) in the current directory. Deleting a post source therefore unpublishes it on the next make.

Previewing

$ ./lih.sh serve 8000
$ # open http://localhost:8000

That's it! Happy writing!

About

lih2 is a simple blog creation and maintanance tool

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages