Documentation ¶
Overview ¶
Package models contains all models used for representing data in the application as well as functions for manipulating that data.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatPostHeadMatter ¶
func FormatPostHeadMatter(hm HeadMatter) string
func ParsePostContent ¶
ParsePostContent parses the HeadMatter and HTML from a raw post.
func ParsePostId ¶
ParsePostId parses a file path from an url parameter.
func ParsePostSlugAndType ¶
ParsePostSlugAndType parses a post's slug and type from its filename. The file extension is used for the post type. The slug is grabbed from the basename sans a prefixed date used for organization. It returns the post's slug and type.
Types ¶
type HeadMatter ¶
type HeadMatter struct { Title string `json:"title",yaml:"title,omitempty"` Date string `json:"date",yaml:"date,omitempty"` Categories []string `json:"categories",yaml:"categories,omitempty"` MetaDescription string `json:"meta_description",yaml:"meta_description,omitempty"` FeatureImage string `json:"feature_image",yaml:"feature_image,omitempty"` }
Represents the possible data contained within the head matter section of a post, fenced with leading and following --- lines.
func ParsePostHeadMatter ¶
func ParsePostHeadMatter(contents []byte) (HeadMatter, []byte)
type Post ¶
type Post struct { Id int64 `json:"id"` Title string `json:"title"` Slug string `json:"slug"` ParentId int64 `json:"parent_id"` Content template.HTML `json:"content"` Raw string `json:"raw"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` PublishedAt time.Time `json:"published_at"` HeadMatter HeadMatter `json:"head_matter"` Filename string `json:"filename"` Directory string `json:"directory"` Type string `json:"type"` }
func GetAllPosts ¶
GetAllPosts returns all posts from the storage system by name.