baja

package module
v0.3.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 27, 2020 License: MIT Imports: 9 Imported by: 0

README

baja

A minimal static site generator

Status

Code is crappy at this stage. I mostly work on train and just try to get thing done to sync among work/personal laptop.

Concept

Baja simply looks at a directory and find file recursive and render individual page in a layout plus an index page of each directory.

To look up the template for render, if it's a single page, it use themes/name/node.html. If it's an index, it used list.html.

Plus, if it has an index.html page, that template are used to render index of whole site. otherwise it used list.html.

Getting started

The API is similar to git

# First time, bootstrap
baja new

# Add a post
baja add directory/post/

# Import from Gist or Evernote
baja import url

# Spit out static file
baja build

# You need to have 
baja deploy s3

# of if you're using Github page
baja deploy github

Why the name

When my daughter started to speak, baja was one the word she kept saying for no reason. No one in family know what it means. It remains unknow nowsaday and she eventually stop saying when she know more words

But the word baja light up my days a lot.

Release

  • 2019/02/09: 0.0.2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Create added in v0.3.0

func Create(name string) error

Initalize a new blog directory

func FuncMaps added in v0.0.4

func FuncMaps() template.FuncMap

Types

type Config

type Config struct {
	Theme string `"yaml":theme`
	Site  string `"yaml":site`
	// contains filtered or unexported fields
}

func NewConfig

func NewConfig(path string) *Config

func (*Config) WriteFile

func (c *Config) WriteFile()

type Context added in v0.3.0

type Context struct {
	Config  *Config
	Current *Current
	Theme   *Theme
}

func NewContext added in v0.3.0

func NewContext(config *Config) *Context

type Current added in v0.0.2

type Current struct {
	IsHome bool
	IsDir  bool
	IsTag  bool
	IsList bool

	CompiledAt time.Time
}

Current is a struct about various current state we pass to template to help us do some business logic depend on a context

type InitCommand added in v0.3.0

type InitCommand struct {
}

func (*InitCommand) ArgDesc added in v0.3.0

func (cmd *InitCommand) ArgDesc() string

func (*InitCommand) Help added in v0.3.0

func (cmd *InitCommand) Help() string

func (*InitCommand) Run added in v0.3.0

func (cmd *InitCommand) Run(s *Site, args []string) int

type Site

type Site struct {
	Config *Config
	Theme  *Theme

	Meta *SiteMeta
	Path *SitePath
}

func LoadSite added in v0.3.0

func LoadSite(configpath string) *Site

type SiteMeta added in v0.3.0

type SiteMeta struct {
	Name    string `"yaml":name`
	Author  string `"yaml":author`
	BaseURL string `"yaml":baseURL`
}

type SitePath added in v0.3.0

type SitePath struct {
	Content string
	Output  string
}

type Theme added in v0.0.4

type Theme struct {
	Name string
	// contains filtered or unexported fields
}

func NewThemeFromConfig added in v0.3.0

func NewThemeFromConfig(config *Config) *Theme

func (*Theme) LayoutPath added in v0.0.4

func (t *Theme) LayoutPath(name string) string

func (*Theme) NodePath added in v0.0.4

func (t *Theme) NodePath(node string) string

func (*Theme) Path added in v0.0.4

func (t *Theme) Path() string

func (*Theme) SubPath added in v0.0.4

func (t *Theme) SubPath(subpath string) string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL