site

package
v0.0.0-...-5a527e5 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2021 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Day

func Day(datetime time.Time) string

Day returns the day for a timestamp.

func Month

func Month(datetime time.Time) string

Month returns the month for a timestamp.

func MonthAndYear

func MonthAndYear(datetime time.Time) string

MonthAndYear returns the month and year for a timestamp.

func PrettyDate

func PrettyDate(datetime time.Time) string

PrettyDate returns a nicely rendered timestamp for this page, based on its date.

func PublishDate

func PublishDate(datetime time.Time) string

PublishDate returns a RSS friendly timestamp.

func TemplateFuncs

func TemplateFuncs() template.FuncMap

TemplateFuncs returns a template.FuncMap of functions used in our templates.

func ToMarkdown

func ToMarkdown(content string) template.HTML

ToMarkdown returns the passed content as a string containing HTML. This string is returned as a template.HTML value, so it is render directly in HTML templates, rather than being escaped.

func Year

func Year(datetime time.Time) string

Year returns the year for a timestamp.

Types

type Config

type Config interface {
	Site() Site
	Templates() *template.Template
	Location() *time.Location
}

Config represents a site's configuration. A site's configuration must track the location (timezone) that it operates in, all of the available templates and the site wide variable.s

type Page

type Page interface {
	Title() string
	Path() string
	Filename() string
	OutFilename() string
	ContentStart() int64
	Content() (string, error)
	SetSite(site Site)
	Site() Site
	Template() string
}

Page represents a page on the site. All pages should implement this interface, including blog posts, so as to enable the tree renderer to render them properly.

type Site

type Site struct {
	Title       string `json:"title"`
	Root        string `json:"root"`
	Description string `json:"description"`
	BlogFeed    string `json:"blog_feed"`
	AuthorName  string `json:"author_name"`
	Footer      string `json:"footer"`
}

Site is a structure that contains global, site wide variables. These variables can be used in templates, and are used when rendering the blog's feed.

func (site Site) Permalink(v ...string) (string, error)

Permalink returns the passed value as a permalink, with the value of site.Root prefixed.

For example, if a site is configured with "http://localhost" as the root, calling site.Permalink("a", "b", "c") will return "http://localhost/a/b/c".

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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