front_matter

package
v0.2.11 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FrontMatter

type FrontMatter struct {
	InternalFields `yaml:"-"` // 构建时生成的字段

	Title   string `yaml:"title"`
	Summary string `yaml:"summary"`
	Image   string `yaml:"image"`
	URL     string `yaml:"url"` // 自定义文章 URI 或用于 ExternalPost 的链接

	Date    string `yaml:"date"`    // 默认显示,用于排序
	Updated string `yaml:"updated"` // 次要的更新时间

	Author     string `yaml:"author"`
	AuthorLink string `yaml:"author_link"`

	Category string   `yaml:"category"`
	Tags     []string `yaml:"tags"`

	Flags []string `yaml:"flags"`

	HeadTags []template.HTML `yaml:"head_tags"`
}

func (*FrontMatter) CheckInfo

func (fm *FrontMatter) CheckInfo()

func (*FrontMatter) ParseDates

func (fm *FrontMatter) ParseDates(d fs.DirEntry)

func (*FrontMatter) ParseFlags

func (fm *FrontMatter) ParseFlags()

type InternalFields

type InternalFields struct {
	BuildPath string // html 文件路径
	FilePath  string // 源文件路径
	FullURI   string // 相比 URL 会带上 `.html` 或 `/` 后缀,若是外部链接则没区别

	TimeDate    time.Time
	TimeUpdated time.Time // 次要的更新时间

	ParsedFlags ParsedFlags
}

type ParsedFlags

type ParsedFlags struct {
	HidePost bool `yaml:"hide_post"`

	ShowInCategoryAndTag bool `yaml:"show_in_category_and_tag"`
	ShowInRSSAndSitemap  bool `yaml:"show_in_rss_and_sitemap"`

	ExternalPost bool `yaml:"external_post"`

	HideImageAtPostList bool `yaml:"hide_image_at_post_list"`
	HideImageAtPostTop  bool `yaml:"hide_image_at_post_top"`

	EscapeHTML bool `yaml:"escape_html"` // This flag is for rss/atom

	NoHeadingID     bool `yaml:"no_heading_id"`
	NoHeadingAnchor bool `yaml:"no_heading_anchor"`
	NoCodeHighlight bool `yaml:"no_code_highlight"`
	NoImagePreview  bool `yaml:"no_image_preview"`

	NoTrailingSlash bool `yaml:"no_trailing_slash"`

	NoComment bool `yaml:"no_comment"`
}

func (*ParsedFlags) SetForRSS

func (pf *ParsedFlags) SetForRSS() error

SetForRSS will always return nil, because a return value is required when calling it in the template.

Jump to

Keyboard shortcuts

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