content

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2021 License: MIT Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const UncategorizedId = "uncategorized"
View Source
const UncategorizedName = "未分类"

Variables

This section is empty.

Functions

func Categories

func Categories() []configs.Category
func Footer() template.HTML

func GetCategory

func GetCategory(categoryId string) (configs.Category, bool)

func Load

func Load()

func Page404

func Page404() template.HTML

func PageNotAuthor

func PageNotAuthor() template.HTML

func Render

func Render(c *fiber.Ctx, tpl string, data interface{}) error

Types

type HTMLPage added in v1.0.2

type HTMLPage struct {
	Heads   []toc.Head
	Content []byte
}

func MarkdownPage

func MarkdownPage(filename string, offset int) (*HTMLPage, error)

type MetaData

type MetaData struct {
	// 文章标签
	Tags []string `yaml:"Tags"`
	// 文章更新时间
	UpdateAt time.Time `yaml:"UpdateAt"`
	// 文章副标题
	Subtitle string `yaml:"Subtitle"`
	// 文章标题
	Title string `yaml:"Title"`
	// 草稿标记
	// 通过控制台qrcode得到预览草稿链接
	IsDraft bool `yaml:"Draft"`

	// 文件路径
	Filename string `yaml:"-"`
	// 除去yaml头的偏移量
	Offset int `yaml:"-"`
	// 概要,取文章前256个字符
	Summary template.HTML `yaml:"-"`
	// 内联标题
	InlineTitle bool `yaml:"-"`
	// 存在meta头
	HasMetaHead bool `yaml:"-"`
	// 分类ID
	CategoryID string `yaml:"-"`
	// 文件修改时间,用于检查修改变动
	ModifyTime time.Time `yaml:"-"`
	// contains filtered or unexported fields
}

func ArticlesByCategoryPage

func ArticlesByCategoryPage(categoryId string, pageSize, pageNumber int) (total int, heads []MetaData)

func ArticlesByPage

func ArticlesByPage(pageSize, pageNumber int) (total int, heads []MetaData)

func ArticlesByTagPage

func ArticlesByTagPage(tag string, pageSize, pageNumber int) (total int, heads []MetaData)

func FindMetaData

func FindMetaData(filename string) (MetaData, bool)

func List

func List() (articles []MetaData)

罗列所有文章的Meta头

func (MetaData) UpdateFromNow added in v1.0.2

func (md MetaData) UpdateFromNow() string

type Tag

type Tag struct {
	Name  string
	Count int
}

func Tags

func Tags() []Tag

Jump to

Keyboard shortcuts

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