site

package
v0.2.14 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2024 License: MIT Imports: 27 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Document added in v0.2.6

type Document = pages.Document

Document is in package pages.

type FilesEvent added in v0.1.0

type FilesEvent struct {
	Time  time.Time // A single time is used for all the changes
	Paths []string  // relative to site source
}

FilesEvent is a list of changed or added site source files, with a single timestamp that approximates when they were changed.

func (FilesEvent) String added in v0.1.0

func (e FilesEvent) String() string

type Page added in v0.2.6

type Page = pages.Page

Page is in package pages.

type Site

type Site struct {
	Collections []*collection.Collection
	Routes      map[string]Document // URL path -> Document; only for output pages
	// contains filtered or unexported fields
}

Site is a Jekyll site.

func FromDirectory

func FromDirectory(dir string, flags config.Flags) (*Site, error)

FromDirectory reads the configuration file, if it exists.

func New

func New(flags config.Flags) *Site

New creates a new site record, initialized with the site defaults.

func (*Site) AbsDir

func (s *Site) AbsDir() string

AbsDir is in the collection.Site interface.

func (*Site) AddDocument

func (s *Site) AddDocument(d Document, output bool)

AddDocument adds a document to the site's fields. It ignores unpublished documents unless config.Unpublished is true.

func (*Site) AddHTMLPage added in v0.2.6

func (s *Site) AddHTMLPage(url string, src string, fm pages.FrontMatter)

AddHTMLPage is in the plugins.Site interface.

func (*Site) Clean

func (s *Site) Clean() error

Clean the destination. Remove files that aren't in keep_files, and resulting empty directories.

func (*Site) Config

func (s *Site) Config() *config.Config

Config is in the collection.Site interface.

func (*Site) DestDir

func (s *Site) DestDir() string

DestDir returns the site destination directory.

func (*Site) Exclude

func (s *Site) Exclude(siteRel string) bool

Exclude returns a boolean indicating that the site configuration excludes a file or directory. It does not exclude top-level _underscore files and directories.

func (*Site) FilePathPage

func (s *Site) FilePathPage(rel string) (Document, bool)

FilePathPage returns a Page, give a file path relative to site source directory.

func (*Site) FilenameURLPath

func (s *Site) FilenameURLPath(relpath string) (string, bool)

FilenameURLPath returns a page's URL path, give a relative file path relative to the site source directory.

func (*Site) FilenameURLs

func (s *Site) FilenameURLs() map[string]string

FilenameURLs returns a map of site-relative pathnames to URL paths

func (*Site) HasLayout added in v0.2.6

func (s *Site) HasLayout(ln string) bool

HasLayout is in the plugins.Site interface.

func (*Site) KeepFile

func (s *Site) KeepFile(filename string) bool

KeepFile returns a boolean indicating that clean should leave the file in the destination directory.

func (*Site) OutputDocs added in v0.1.0

func (s *Site) OutputDocs() []Document

OutputDocs returns a list of output pages.

func (*Site) Pages

func (s *Site) Pages() (out []Page)

Pages returns all the pages, output or not.

func (*Site) PathPrefix

func (s *Site) PathPrefix() string

PathPrefix is in the page.Container interface.

func (*Site) Posts added in v0.2.6

func (s *Site) Posts() []Page

Posts is part of the plugins.Site interface.

func (*Site) Read

func (s *Site) Read() error

Read loads the site data and files.

func (*Site) ReadCollections

func (s *Site) ReadCollections() (err error)

ReadCollections reads the pages of the collections named in the site configuration. It adds each collection's pages to the site map, and creates a template site variable for each collection.

func (*Site) RelativePath added in v0.2.0

func (s *Site) RelativePath(path string) string

RelativePath is in the page.Container interface.

func (*Site) Reloaded added in v0.1.0

func (s *Site) Reloaded(paths []string) (*Site, error)

Reloaded returns the same or a new site reading the same source directory, configuration file, and load flags. build --incremental and site --incremental use this.

func (*Site) RendererManager added in v0.2.5

func (s *Site) RendererManager() renderers.Renderers

RendererManager returns the rendering manager.

func (*Site) RequiresFullReload added in v0.2.3

func (s *Site) RequiresFullReload(paths []string) bool

RequiresFullReload returns true if a source file requires a full reload / rebuild.

This is always true outside of incremental mode, since even a static asset can cause pages to change if they reference its variables.

This function works on relative paths. It does not work for theme sources.

func (*Site) SetAbsoluteURL

func (s *Site) SetAbsoluteURL(url string)

SetAbsoluteURL overrides the loaded configuration. The server uses this.

func (*Site) Site

func (s *Site) Site() interface{}

Site is in the pages.RenderingContext interface.

func (*Site) SourceDir

func (s *Site) SourceDir() string

SourceDir returns the site source directory.

func (*Site) TemplateEngine

func (s *Site) TemplateEngine() *liquid.Engine

TemplateEngine is part of the plugins.Site interface.

func (*Site) ToLiquid

func (s *Site) ToLiquid() interface{}

ToLiquid returns the site variable for template evaluation.

func (*Site) URLPage

func (s *Site) URLPage(urlpath string) (p Document, found bool)

URLPage returns the page that will be served at URL

func (*Site) WatchFiles added in v0.1.0

func (s *Site) WatchFiles() (<-chan FilesEvent, error)

WatchFiles returns a channel that receives FilesEvent on changes within the site directory.

func (*Site) WatchRebuild added in v0.1.0

func (s *Site) WatchRebuild() (<-chan interface{}, error)

WatchRebuild watches the site directory. Each time a file changes, it rebuilds the site. It sends status messages (strings) and errors to its output channel.

TODO use a logger instead of a message channel?

func (*Site) Write added in v0.2.5

func (s *Site) Write() (int, error)

Write cleans the destination and writes files into it. It sets TZ from the site config.

func (*Site) WriteDoc added in v0.1.0

func (s *Site) WriteDoc(d Document) error

WriteDoc writes a document to the destination directory.

func (*Site) WriteDocument

func (s *Site) WriteDocument(w io.Writer, d Document) error

WriteDocument writes the rendered document.

func (*Site) WriteFiles added in v0.1.0

func (s *Site) WriteFiles() (count int, err error)

WriteFiles writes output files.

func (*Site) WritePage added in v0.1.0

func (s *Site) WritePage(w io.Writer, p Page) error

WritePage writes the rendered page. It is called as part of site.Write, but also, in an incremental build, to write a single page – therefore it also ensures that all pages have been rendered before writing this one.

Jump to

Keyboard shortcuts

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