post

package
v0.0.0-...-c82a0c2 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IndexHandler

func IndexHandler(mq MetaDataQuerier, tpl *template.Template) http.HandlerFunc

func PostHandler

func PostHandler(sl SlugReader, tpl *template.Template) http.HandlerFunc

Types

type Author

type Author struct {
	Name   string `toml:"name"`
	Email  string `toml:"email"`
	GitHub string `toml:"github"`
}

type FileReader

type FileReader struct {
	// Dir is the directory where the markdown files are stored
	Dir string
}

func (FileReader) Query

func (fr FileReader) Query() ([]PostMetaData, error)

func (FileReader) Read

func (fr FileReader) Read(slug string) (string, error)

type IndexData

type IndexData struct {
	Posts []PostMetaData
}

type MetaDataQuerier

type MetaDataQuerier interface {
	Query() ([]PostMetaData, error)
}

type PostData

type PostData struct {
	Title   string `toml:"title"`
	Content template.HTML
	Author  Author `toml:"author"`
}

type PostMetaData

type PostMetaData struct {
	Slug        string
	Title       string    `toml:"title"`
	Author      Author    `toml:"author"`
	Description string    `toml:"description"`
	Date        time.Time `toml:"date"`
}

type SlugReader

type SlugReader interface {
	Read(slug string) (string, error)
}

Jump to

Keyboard shortcuts

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