Documentation ¶
Overview ¶
Package mdfile 是用来解析处理 markdown 文件的包
Index ¶
- Variables
- type Article
- type Articles
- type Categories
- type Category
- type List
- type ListMap
- func (list *ListMap) ArticleByPath(path string) (Article, error)
- func (list *ListMap) ArticlesAll() Articles
- func (list *ListMap) ArticlesByCategory(name string) Articles
- func (list *ListMap) ArticlesByTag(title string) Articles
- func (list *ListMap) CategoriesAll() Categories
- func (list *ListMap) Reload()
- func (list *ListMap) TagsAll() Tags
- type Tag
- type Tags
Constants ¶
This section is empty.
Variables ¶
View Source
var Model = new()
Model 博客内容的实例
Functions ¶
This section is empty.
Types ¶
type Article ¶
type Article struct { // 文章的标题 Title string // 作者姓名 Author string // 创建时间 CreatedAt time.Time `toml:"created_at"` // 最后更新时间 UpdatedAt time.Time `toml:"updated_at"` // 标签 Tags []string // 所属分类的名称 Category string // 头部图片 URL 地址 HeadImg string `toml:"head_img"` // 作者的个人主页 HomePage string `toml:"home_page"` // 简短的描述 Description string // 文章主题内容, markdown Body string // 文章在服务器上的文件路由 Path string }
Article 文章内容
type Articles ¶
type Articles []Article
Articles 文章列表
type Category ¶
type Category struct { // 分类的名称,用来做头部菜单的文本 Title string // 分类下文章的数量 Number int // 分类的文件目录, 当 OutLink 为 true 时,这里应该是一个外链, // 否则是 markdown 文档保存的子目录 Path string // 分类的描述 Description string // 当是一个外联时,就不会再去获取对应的 markdown 文档 OutLink bool `toml:"out_link"` // 是否是激活状态 Active bool }
Category 文章分类
type List ¶
type List interface { CategoriesAll() Categories TagsAll() Tags ArticlesAll() Articles ArticleByPath(string) (Article, error) ArticlesByCategory(string) Articles ArticlesByTag(string) Articles Reload() }
List 博客列表
type ListMap ¶
ListMap 将博客保存在 map 中,
func (*ListMap) ArticleByPath ¶
ArticleByPath 根据文章的 Path 查询指定的文章
func (*ListMap) ArticlesByCategory ¶
ArticlesByCategory 根据分类获取博客列表
func (*ListMap) ArticlesByTag ¶
ArticlesByTag 根据标签获取博客列表
func (*ListMap) CategoriesAll ¶
func (list *ListMap) CategoriesAll() Categories
CategoriesAll 获取所有的分类列表
Click to show internal directories.
Click to hide internal directories.