Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DB *jsondb.DB
DB is a reference to the parent app's JsonDB object.
View Source
var (
ThumbnailImageRegexp = regexp.MustCompile(`['"(]([a-zA-Z0-9-_:/?.=&]+\.(?:jpe?g|png|gif))['")]`)
)
Regexp used to parse a thumbnail image from a blog post. Looks for the first URI component ending with an image extension.
Functions ¶
func UpdateIndex ¶
UpdateIndex updates a post's metadata in the blog index.
Types ¶
type ByPopularity ¶
type ByPopularity []Tag
ByPopularity sort type.
func (ByPopularity) Len ¶
func (s ByPopularity) Len() int
func (ByPopularity) Less ¶
func (s ByPopularity) Less(i, j int) bool
func (ByPopularity) Swap ¶
func (s ByPopularity) Swap(i, j int)
type Index ¶
type Index struct { Posts map[int]Post `json:"posts"` Fragments map[string]int `json:"fragments"` Thumbnails map[int]string `json:"thumbnails"` }
Index caches high level metadata about the blog's contents for fast access.
type Post ¶
type Post struct { ID int `json:"id"` Title string `json:"title"` Fragment string `json:"fragment"` ContentType string `json:"contentType,omitempty"` AuthorID int `json:"author"` Body string `json:"body,omitempty"` Privacy string `json:"privacy"` Sticky bool `json:"sticky"` EnableComments bool `json:"enableComments"` Tags []string `json:"tags"` Created time.Time `json:"created"` Updated time.Time `json:"updated"` }
Post holds information for a blog post.
func LoadFragment ¶
LoadFragment loads a blog entry by its URL fragment.
func (*Post) ExtractThumbnail ¶
ExtractThumbnail searches and returns a thumbnail image to represent the post. This will be the first image embedded in the post, or nothing.
Click to show internal directories.
Click to hide internal directories.