web

package
v0.0.0-...-db2f016 Latest Latest
Warning

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

Go to latest
Published: May 8, 2022 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseData

type BaseData struct {
	Now time.Time
}

type ContentDir

type ContentDir string

Type for serving static files within an individual post's directory.

func (ContentDir) Open

func (c ContentDir) Open(name string) (http.File, error)

Returns files to serve over HTTP, but only if those files aren't the raw markdown and aren't in a directory called "exclude."

type PostData

type PostData struct {
	BaseData
	*content.Post
	Content template.HTML
}

type RootData

type RootData struct {
	BaseData
	Posts       *content.PostIndex
	LatestURL   string // *absolute* URL
	RelativeURL string
	Title       string
}

type Server

type Server struct {
	PublicURL *url.URL

	Posts *content.PostIndex
	// contains filtered or unexported fields
}

func NewServer

func NewServer(publicURL, contentDir, themeDir string) (*Server, error)

Creates (but does not run!) a server. Steps include:

  • load all templates
  • load all content
  • set up all routes

func (*Server) GetTemplate

func (s *Server) GetTemplate(w http.ResponseWriter, name string) *template.Template

func (*Server) GetURLs

func (s *Server) GetURLs() ([]string, error)

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

Jump to

Keyboard shortcuts

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