site

package
v0.0.0-...-500a3cd Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2020 License: Apache-2.0, MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetContentFolders

func GetContentFolders(path string) ([]string, error)

GetContentFolders retrive the dir names from content folder

func GetTemplate

func GetTemplate(path string) (*template.Template, error)

GetTemplate read the template file

Types

type Cache

type Cache struct {
	// contains filtered or unexported fields
}

Cache holds the site

func NewCache

func NewCache() *Cache

NewCache initiate a new cache

func (*Cache) Get

func (c *Cache) Get(key string) interface{}

Get for a key return the item(page/post)

func (*Cache) GetKeys

func (c *Cache) GetKeys() []string

GetKeys retrive keys

func (*Cache) GetValues

func (c *Cache) GetValues() []interface{}

GetValues provide the values

func (*Cache) Set

func (c *Cache) Set(key string, item interface{})

Set the key for an item

type ContentCache

type ContentCache map[string]interface{}

ContentCache create a key, page relation

type Image

type Image struct {
	Name    string
	Imgfile []byte
	Mime    string
	Etag    string
}

Image holds image file

type ImgConfig

type ImgConfig struct {
	ImgPath string
	Cache   *Cache
}

ImgConfig holds the configuration for images

func NewImgConfig

func NewImgConfig(imgpath string) *ImgConfig

NewImgConfig generate new post configuration

func (*ImgConfig) GetImage

func (i *ImgConfig) GetImage(key string) *Image

GetImage get the image content from cache

func (*ImgConfig) Read

func (i *ImgConfig) Read() error

type IndexData

type IndexData struct {
	HTMLTitle       string
	PageTitle       string
	Content         template.HTML
	Year            int
	Name            string
	CanonicalLink   string
	MetaDescription string
	HighlightCSS    template.CSS
}

IndexData holds Index page data used by both posts & landingpage

type LandingConfig

type LandingConfig struct {
	// contains filtered or unexported fields
}

LandingConfig holds Landing page config

func NewLandingConfig

func NewLandingConfig(posts *PostConfig, templates *template.Template) *LandingConfig

NewLandingConfig initiate the Landing page config

func (*LandingConfig) Generate

func (l *LandingConfig) Generate() error

Generate the landing page

func (*LandingConfig) Get

func (l *LandingConfig) Get(key string) *LandingPage

Get the page from cache

type LandingPage

type LandingPage struct {
	Content      *[]byte
	Mime         string
	Etag         string
	CacheControl string
}

LandingPage holds the content of the main/index page

type Meta

type Meta struct {
	Title   string   `json:"title"`
	Short   string   `json:"short"`
	Date    string   `json:"date"`
	Tags    []string `json:"tags"`
	Created time.Time
}

Meta holds the post metadata

type Post

type Post struct {
	Name    string
	Meta    *Meta
	Content []byte
	Etag    string
}

Post holds post data

type PostConfig

type PostConfig struct {
	OrderedPosts []*Post
	Paths        []string
	Template     *template.Template
	Cache        *Cache
}

PostConfig holds post config

func NewPostConfig

func NewPostConfig(paths []string, template *template.Template) *PostConfig

NewPostConfig generate new post configuration

func (*PostConfig) Generate

func (p *PostConfig) Generate() error

Generate the posts from config

func (*PostConfig) Get

func (p *PostConfig) Get(key string) *Post

Get the post content from cache

type PostsListing

type PostsListing struct {
	Title string
	Date  string
	Short string
	Link  string
	Tags  []string
}

PostsListing holds the data for post listed in index page

Jump to

Keyboard shortcuts

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