gen

package module
v0.0.0-...-219d55f Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2020 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compile

func Compile()

func ConfInit

func ConfInit()

func CreateMarkdown

func CreateMarkdown(filename string) string

func GetPages

func GetPages(pageSize int) int

获取页数

func Init

func Init()

func ListenHTTPServer

func ListenHTTPServer(port int)

func LoadArticle

func LoadArticle()

加载所有的markdown文件

func MDList

func MDList() []string

获取 markdown 文件夹下所有.md文件的路径名

Types

type Article

type Article struct {
	Id          int    `json:"article_id"`
	Title       string `json:"title"`
	Description string `json:"description"`
	Author      string `json:"author"`

	Summary  string   `json:"summary"`
	Content  string   `json:"content"`
	Tags     []string `json:"tags"`
	Category []string `json:"cate"`

	CreatedAt int64  `json:"created_at"`
	UpdatedAt int64  `json:"updated_at"`
	Url       string `json:"url"`
}

Article 定义了一篇文章所需要的要素

func GetHomeArt

func GetHomeArt(pageNum, pageSize int) []*Article

获取首页文章

type Articles

type Articles []*Article

func (Articles) Len

func (a Articles) Len() int

func (Articles) Less

func (a Articles) Less(i, j int) bool

func (Articles) Swap

func (a Articles) Swap(i, j int)

type Website

type Website struct {
	Title      string `yaml:"title"`
	WebsiteUrl string `yaml:"url"`

	SubTitle    string `yaml:"subtitle"`
	Description string `yaml:"description"`
	Keywords    string `yaml:"keywords"`

	Markdown string `yaml:"markdown"` // md存储路径
	Dist     string `yaml:"output"`   // 输出编译输出文件

	Theme string `yaml:"theme"`

	Author  string `yaml:"author"`
	Avatar  string `yaml:"avatar"`
	Contact string `yaml:"contact"`
	Github  string `yaml:"github"`
	Mail    string `yaml:"mail"`

	PageSize int `yaml:"pageSize"`

	Cates []string `yaml:"cate"`
	Paths []string `yaml:"paths"`
	Exts  []string `yaml:"exts"`

	HomeArtNum   int    `yaml:"pageNum"`
	HomeTitle    string `yaml:"home_title,omitempty"`
	ArchiveTitle string `yaml:"archive_title,omitempty"`
	TagTitle     string `yaml:"tag_title,omitempty"`
	CateTitle    string `yaml:"cate_title,omitempty"`
	AboutTitle   string `yaml:"about_title,omitempty"`
	ArticleTitle string `yaml:"article_title,omitempty"`
}

func Config

func Config() Website

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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