one

package module
v0.0.0-...-c37fc44 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2023 License: MIT Imports: 14 Imported by: 0

README

one

A hybrid customizable blog platform.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type List

type List struct {
	*Post
	Site  Site    `json:"site"`
	Posts []*Post `json:"posts"`
}

type Metadata

type Metadata map[string]interface{}

type One

type One struct {
	http.Handler
	// contains filtered or unexported fields
}

func New

func New(opts ...Option) *One

func (*One) Bundle

func (o *One) Bundle(ctx context.Context) error

func (*One) Dump

func (o *One) Dump(w io.Writer) error

func (One) Generate

func (o One) Generate(ctx context.Context) error

func (*One) Load

func (o *One) Load(r io.Reader) error

type Option

type Option func(*Options)

func WithHash

func WithHash(enable bool) Option

func WithMinify

func WithMinify(enable bool) Option

func WithOutputDir

func WithOutputDir(path string) Option

func WithSourceDir

func WithSourceDir(path string) Option

func WithTemplateFeed

func WithTemplateFeed(name string) Option

func WithTemplateLayout

func WithTemplateLayout(name string) Option

func WithTemplateList

func WithTemplateList(name string) Option

func WithTemplatePost

func WithTemplatePost(name string) Option

func WithTemplates

func WithTemplates(ts map[string]Template) Option

func WithThemeDir

func WithThemeDir(path string) Option

func WithTreeShaking

func WithTreeShaking(enable bool) Option

type Options

type Options struct {
	SourceDir      string
	OutputDir      string
	ThemeDir       string // relative to ThemeDir
	TemplateFeed   string // relative to ThemeDir e.g. atom.xml
	TemplateLayout string // relative to ThemeDir e.g. layout.html
	TemplatePost   string // relative to ThemeDir e.g. post.html
	TemplateList   string // relative to ThemeDir e.g. list.html
	AssetStyle     string // relative to ThemeDir e.g. index.css
	AssetScript    string // relative to ThemeDir e.g. index.js
	Templates      map[string]Template
	Minify         bool
	Treeshaking    bool
	Hash           bool
}

type Post

type Post struct {
	Site     Site          `json:"site"`
	Name     string        `json:"name"`
	Path     string        `json:"path"`
	Markdown string        `json:"markdown"`
	HTML     template.HTML `json:"html"`
	Metadata Metadata      `json:"metadata"`
	Size     int64         `json:"size"`
}

type Site

type Site struct {
	Style    string   `json:"style"`
	Script   string   `json:"script"`
	Posts    []*Post  `json:"posts"`
	Metadata Metadata `json:"metadata"` // extracted from config file like `one.yml`
}

type Template

type Template struct {
	Name string
	Fold bool
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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