package site
import "go.astrophena.name/site"
Package site builds https://astrophena.name.
Directory Structure ¶
Site has the following directories:
build This is where the generated site will be placed by default. pages All content for the site lives inside this directory. HTML and Markdown formats can be used. static Files in this directory will be copied verbatim to the generated site. templates These are the templates that wrap pages. Templates are chosen on a page-by-page basis in the front matter. They must have the '.html' extension.
Page Layout ¶
Each page must be of the supported format (HTML or Markdown) and have JSON front matter in the beginning:
{ "title": "Hello, world!", "template": "layout", "permalink": "/hello-world" }
See Page for all available front matter fields.
Index ¶
- Constants
- func Build(c *Config) error
- func Serve(c *Config, addr string) error
- type Config
- type Env
- type Logf
- type Page
Package Files ¶
Constants ¶
❖
const ( // Everything is included. Dev = Env("dev") // Drafts are excluded. Also the base URL is used to derive absolute URLs from // relative ones. Prod = Env("prod") )
Available environments.
func Build ¶
Build builds a site based on the provided Config.
func Serve ¶
Serve builds the site and starts serving it on a provided host:port.
type Config ¶
❖
type Config struct { // Title is the title of the site. Title string // Author is the name of the author of the site. Author string // Env is the environment to use when building. Env Env // BaseURL is the base URL of the site. BaseURL *url.URL // Src is the directory where to read files from. If empty, uses the current // directory. Src string // Dst is the directory where to write files. If empty, uses the build // directory. Dst string // Logf specifies a logger to use. If nil, log.Printf is used. Logf Logf }
Config represents a build configuration.
type Env ¶
Env is the environment for which site can be built.
type Logf ¶
Logf is a simple printf-like logging function.
type Page ¶
❖
type Page struct { Title string `json:"title"` // title: Page title, required. Summary string `json:"summary"` // summary: Page summary, used in RSS feed, optional. Type string `json:"type"` // type: Used to distinguish different kinds of pages, page by default. Permalink string `json:"permalink"` // permalink: Output path for the page, required. Date *date `json:"date"` // date: Publication date in the 'year-month-day' format, e.g. 2006-01-02, optional. Draft bool `json:"draft"` // draft: Determines whether this page should be not included in production builds, false by default. Template string `json:"template"` // template: Template that should be used for rendering this page, required. ContentOnly bool `json:"content_only"` // content_only: Determines whether this page should be rendered without header and footer, false by default. // contains filtered or unexported fields }
Page represents a site page. The exported fields is the front matter fields.
- Version
- v0.0.0-20220621214244-38be813270fb (latest)
- Published
- Jun 21, 2022
- Platform
- linux/amd64
- Imports
- 26 packages (graph)
- Last checked
- 1 week ago –
Tools for package owners.