generator

package
v0.0.0-...-95fa9ed Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2020 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

sitemap.go fenerate aitemap.xml for site

Index

Constants

View Source
const (
	PageTypeIndex  = "index"
	PageTypeTag    = "tag"
	PageTypeCat    = "category"
	PageTypePost   = "post"
	PageTypeArh    = "archives"
	PageTypeArhIdx = "archiveIndex"
)

Variables

This section is empty.

Functions

func ClearDir

func ClearDir(path string)

func CopyDir

func CopyDir(src string, dst string) (err error)

func CopyFile

func CopyFile(src, dst string) (err error)

func GenArchive

func GenArchive(posts []Post) map[string][]Post

func SliceToMAP

func SliceToMAP(sl []string) map[string]int

func WriteFile

func WriteFile(c []byte, file string)

Types

type Archive

type Archive struct {
	Year     map[string][]Post
	Archives map[string][]Post
}
type Nav struct {
	Title string
	Link  string
}
type PageNav struct {
	PageCount int
	PageSlice []int
}
func (pn *PageNav) Handler() *PageNav

TODO need a better way to handle pagnition

type Post

type Post struct {
	ID        string
	Title     string
	Category  string
	Created   time.Time
	Date      string
	Year      int
	Unixtime  int64
	Tags      []string
	Content   template.HTML
	Permalink string
	Path      string
	Index     int

	PostNav PostNav
}

func SortPost

func SortPost(posts []Post) []Post

func (*Post) SetNav

func (p *Post) SetNav(p1, p2 *Post) *Post

type PostNav

type PostNav struct {
	Prev Nav
	Next Nav
}

type PostWarp

type PostWarp struct {
	Posts    []Post
	CatPosts map[string][]Post
	TagPosts map[string][]Post
	Archives map[string][]Post
}

func GetPosts

func GetPosts(path string, cfg *config.Config) (PostWarp, []string, []string)

type Site

type Site struct {
	Posts      []Post
	CatPosts   map[string][]Post
	TagPosts   map[string][]Post
	Archive    Archive
	Categories map[string]int
	Tags       map[string]int
	Recent     []Post

	CurrentPage      string
	CurrentPageTitle string
	CurrentPageIndex int
	PrevPageIndex    int
	NextPageIndex    int
	PageNav          *PageNav

	CurrentPost Post

	Cfg *config.Config

	CopyRight string
}

func New

func New(cfFile string) *Site

func (*Site) Atom

func (s *Site) Atom()

func (*Site) Build

func (s *Site) Build()

type Tag

type Tag struct {
	Name string
}

Jump to

Keyboard shortcuts

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