generator

package
v0.0.0-...-9d640bd Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2018 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CollectTemplats

func CollectTemplats(dirname string) []*template.Template

CollectTemplats compiles a list of template searching into the provided dirname

func Templates

func Templates() map[string]*template.Template

Templates() return a list of templates

func WritePost

func WritePost(post *Post, dirname string)

WritePost generates the html file for the given post

Types

type Post

type Post struct {
	FilePath string
	FileName string
	Template string
	Content  template.HTML
	Meta     map[string]string

	// Index is a special flag, the field Related
	// will be filled with all other post objs
	Index   bool
	Related []*Post

	// Status moves the file in a "status" directory
	// ex. outputdir/state/filename
	Status    string
	OutputDir string
}

Post is the type of the post it contains some required information, metas and the content of the file in the content of the file, special variable can be used to access these properties ex: {{.FileName}} outputs the FileName prop, and {{.Meta.MyProp}} outputs a custom prop declared directly in the file

func CollectPosts

func CollectPosts(dirname string) []*Post

CollectPosts compile sa list of post searching into a given dirname

func ReadPost

func ReadPost(filepath string) *Post

ReadPost reads the file and convert it to post object a Post file is a file that contains a Header part and a Content part for info check "YAML front matter"

Jump to

Keyboard shortcuts

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