v0.0.0-...-2824937 Latest Latest

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

Go to latest
Published: Nov 2, 2020 License: MIT, BSD-3-Clause Imports: 15 Imported by: 0



Package blog implements a web server for articles written in present format.



This section is empty.


This section is empty.


This section is empty.


type Config

type Config struct {
	ContentPath  string // Relative or absolute location of article files and related content.
	TemplatePath string // Relative or absolute location of template files.

	BaseURL  string // Absolute base URL (for permalinks; no trailing slash).
	BasePath string // Base URL path relative to server root (no trailing slash).
	GodocURL string // The base URL of godoc (for menu bar; no trailing slash).
	Hostname string // Server host name, used for rendering ATOM feeds.

	HomeArticles int    // Articles to display on the home page.
	FeedArticles int    // Articles to include in Atom and JSON feeds.
	FeedTitle    string // The title of the Atom XML feed

	PlayEnabled bool

Config specifies Server configuration values.

type Doc

type Doc struct {
	Permalink string        // Canonical URL for this document.
	Path      string        // Path relative to server root (including base).
	HTML      template.HTML // rendered article

	Related      []*Doc
	Newer, Older *Doc

Doc represents an article adorned with presentation data.

type Server

type Server struct {
	// contains filtered or unexported fields

Server implements an http.Handler that serves blog articles.

func NewServer

func NewServer(cfg Config) (*Server, error)

NewServer constructs a new Server using the specified config.

func (*Server) ServeHTTP

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

ServeHTTP serves the front, index, and article pages as well as the ATOM and JSON feeds.


Path Synopsis
Package atom defines XML data structures for an Atom feed.
Package atom defines XML data structures for an Atom feed.

Jump to

Keyboard shortcuts

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