posts

package
v0.0.0-...-f648938 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2021 License: MIT Imports: 22 Imported by: 0

Documentation

Overview

posts parses blog posts and generates the static output of the blog.

To generate the output call BuildPosts()

Index

Constants

View Source
const RSSDateFormat = "Mon, 02 Jan 2006 15:04:05 MST"

RSSDateFormat is the format used to output dates in the RSS feed

Variables

This section is empty.

Functions

func BuildPosts

func BuildPosts(inputDir, outputDir string)

BuildPosts finds all the posts in a directory and builds them. The provided directories are converted to an absolute directory before use.

inputDir is the directory where the content of the posts can be found and outputDir is where to output the static content of the blog.

Types

type ChannelXML

type ChannelXML struct {
	XMLName       xml.Name   `xml:"channel"`
	Title         string     `xml:"title"`
	Link          string     `xml:"link"`
	Description   string     `xml:"description"`
	LastBuildDate string     `xml:"lastBuildDate"`
	PubDate       string     `xml:"pubDate"`
	TTL           int        `xml:"ttl"`
	Items         []*ItemXML `xml:"item"`
}

ChannelXML describes the structure or the XML for the channel of the RSS feed. A channel in the RSS feed corresponds to the whole blog. See the RSS specification for more information.

type DirSet

type DirSet map[string]bool

type ItemXML

type ItemXML struct {
	XMLName     xml.Name `xml:"item"`
	Title       string   `xml:"title"`
	Link        string   `xml:"link"`
	Description string   `xml:"description"`
	Guid        string   `xml:"guid"`
	PubDate     string   `xml:pubDate`
}

ItemXML describes the structure if the XML for a single item in the RSS feed. An item in the RSS feed corresponds to a single blog post. See the RSS specification for more information.

type Post

type Post struct {
	// contains filtered or unexported fields
}

Post is a structure that contains all teh information about a single post.

type PostMetadata

type PostMetadata struct {
	// contains filtered or unexported fields
}

PostMetadata stores the metadata about a post.

type Posts

type Posts []*Post

func (Posts) Len

func (p Posts) Len() int

Functions to sort a list of posts by publish date with newest first

func (Posts) Less

func (p Posts) Less(i, j int) bool

func (Posts) Swap

func (p Posts) Swap(i, j int)

type RSSXML

type RSSXML struct {
	XMLName xml.Name    `xml:"rss"`
	Version string      `xml:"version,attr"`
	Channel *ChannelXML `xml:"channel"`
}

RSSXML describes the top level format used to encode the data into XML for the RSS feed. See the RSS specification for more information.

Jump to

Keyboard shortcuts

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