site

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2017 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BuildOptions

type BuildOptions struct {
	DryRun       bool
	UseHardLinks bool
	Verbose      bool
}

BuildOptions holds options for Build and Clean

type Site

type Site struct {
	ConfigFile  *string
	Collections []*collection.Collection
	Routes      map[string]pages.Document // URL path -> Document, only for output pages

	sync.Mutex
	// contains filtered or unexported fields
}

Site is a Jekyll site.

func FromDirectory

func FromDirectory(source 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 pages.Document, output bool)

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

func (*Site) Build

func (s *Site) Build(options BuildOptions) (int, error)

Build cleans the destination and create files in it. It attends to the global options.dry_run.

func (*Site) Clean

func (s *Site) Clean(options BuildOptions) error

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

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(path string) bool

Exclude returns a boolean indicating that the site excludes a file.

func (*Site) FilePathPage

func (s *Site) FilePathPage(rel string) (pages.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) 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) MarshalYAML

func (s *Site) MarshalYAML() (interface{}, error)

MarshalYAML is part of the yaml.Marshaler interface The variables subcommand uses this.

func (*Site) OutputExt

func (s *Site) OutputExt(pathname string) string

OutputExt is in the page.Container interface.

func (*Site) OutputPages

func (s *Site) OutputPages() []pages.Document

OutputPages returns a list of output pages.

func (*Site) Pages

func (s *Site) Pages() (out []pages.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) Read

func (s *Site) Read() error

Read loads the site data and files. It doesn't load the configuration file; NewSiteFromDirectory did that.

func (*Site) ReadCollections

func (s *Site) ReadCollections() 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) Reload

func (s *Site) Reload() (*Site, error)

Reload reloads the config file and pages. It returns a copy.

func (*Site) RenderingPipeline

func (s *Site) RenderingPipeline() pipelines.PipelineInterface

RenderingPipeline returns the rendering pipeline.

func (*Site) SaveDocumentToFile

func (s *Site) SaveDocumentToFile(d pages.Document, filename string) error

SaveDocumentToFile writes a page to filename.

func (*Site) SavePage

func (s *Site) SavePage(p pages.Document, options BuildOptions) error

SavePage writes a document to the destination directory. It attends to options.dry_run.

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 pages.Document, found bool)

URLPage returns the page that will be served at URL

func (*Site) WriteDocument

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

WriteDocument writes the document to a writer.

func (*Site) WritePages

func (s *Site) WritePages(options BuildOptions) (count int, err error)

WritePages writes output files. It attends to options.dry_run.

Jump to

Keyboard shortcuts

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