Skip to content
Mirror for Kai, my static blog generator.
Go Makefile
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
Makefile
README
builder.go when using numbered filenames, posts are now ordered properly Feb 9, 2020
functionality_test.go
go.mod
htmlgen.go
kai.go

README

Kai - A simple blog generator

IMPORTANT NOTE:

    This  project is  essentially  just to  generate my  own
    static blog.  As of  now, it's  not really  intended for
    widespread use,  so some  things are hardcoded  in (like
    the blog title  and various CSS class names).  I made it
    as a way to get away from Jekyll and simplify my own use
    case. The source  is also pretty messy due  to its scope
    changing quite a bit in the beginning of development.


Kai is a small, but  decent, static blog generator. It turns
basic text files  (expected to be in  a '_posts/' directory)
into blog posts,  then creates an index.html  page and lists
each  post  in  order.  Kai  also  features  a  simple  HTML
templating  engine using  its  custom  '.part' files.  These
files are  just standard HTML  files that can be  split into
various pieces  depending on  the end  goal. Part  files can
also  include  other  part  files  within  themselves  using
the '[[filename.part]]'  syntax. The templating  engine will
recursively include  each dependency  of each  included part
file  until everything  has been  resolved. By  default, Kai
expects part files  to reside in a  '_parts/' directory. The
only part file Kai expects is one called: 'index.part'. This
one should be  used as a building block for  the rest of the
site.

Here is the basic directory structure of a Kai project:

    project/
      _parts/  <- A directory containing every '.part' file
                  of the project
      _posts/  <- A directory containing every plaintext
                  file Kai will use as a post.
      assets/  <- Any images or resources.

Kai will automatically generate an index.html file.


Usage
------------------------------------------------------------

As of now Kai only has one command: 'generate'. If given the
required argument  (project directory),  Kai will  build the
project, converting  every post in '_posts/'  to valid HTML,
using the  part files  in '_parts/'  to format  the finished
site. For an example of what a basic Kai project looks like,
see: https://github.com/kyoto-shift/kyoto-shift.github.io


Requirements
------------------------------------------------------------

For a standard  build, Kai only requires Go  >= 1.13. Simply
run 'go build' inside the Kai directory.

For a lighter build Kai requires:
    - Go (1.13+)
    - GNU Make (4.2.1)
    - UPX (3.95)


Building
------------------------------------------------------------

To build  Kai using Make  and UPX, simply run  'make' within
the Kai directory. This will  compile Kai using the '-s' and
'-w' LDFLAGS, then run the compiled binary through UPX using
the  '-9'  flag.  You  can  then  run  'sudo  make  install'
to  automatically  install  Kai  (default:  /usr/local/bin).
Building  Kai like  this normally  shrinks the  final binary
from 1.8MB to 400KB.


Tests
------------------------------------------------------------

Main functionality tests  are in 'functionality_test.go' and
can be run using 'go test' from within the main directory.
You can’t perform that action at this time.