hugolib

package
v0.0.0-...-5b3a7c8 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2022 License: Apache-2.0 Imports: 57 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadConfig

LoadConfig loads Hugo configuration into a new Viper and then adds a set of defaults.

Types

type BuildCfg

type BuildCfg struct {
	// Can be set to build only with a sub set of the content source.
	ContentInclusionFilter *glob.FilenameFilter
}

BuildCfg holds build options used to, as an example, skip the render step.

type ConfigSourceDescriptor

type ConfigSourceDescriptor struct {
	Fs afero.Fs

	// Path to the config file to use, e.g. /my/project/config.toml
	// Multiple config files supported, e.g. 'config.toml, abc.toml'
	// In our case, one config file is just right
	Filename string

	// The project's working dir. Is used to look for additional theme config.
	WorkingDir string
}

ConfigSourceDescriptor describes where to find the config (e.g. config.toml etc.).

type HugoSites

type HugoSites struct {
	Sites []*Site

	*deps.Deps
	// contains filtered or unexported fields
}

HugoSites represents the sites to build. Each site represents a language.

func NewHugoSites

func NewHugoSites(cfg deps.DepsCfg) (*HugoSites, error)

NewHugoSites creates HugoSites from the given config.

func (*HugoSites) Build

func (h *HugoSites) Build(config BuildCfg) error

Build builds all sites. If filesystem events are provided, this is considered to be a potential partial rebuild. --- Let's focus on full build, remove events

func (*HugoSites) Data

func (h *HugoSites) Data() map[string]any

type PageCollections

type PageCollections struct {
	// contains filtered or unexported fields
}

PageCollections contains the page collections for a site.

func (*PageCollections) AllPages

func (c *PageCollections) AllPages() page.Pages

AllPages returns all pages for all languages.

func (*PageCollections) AllRegularPages

func (c *PageCollections) AllRegularPages() page.Pages

AllRegularPages AllPages returns all regular pages for all languages.

func (*PageCollections) Pages

func (c *PageCollections) Pages() page.Pages

Pages returns all pages. This is for the current language only.

func (*PageCollections) RegularPages

func (c *PageCollections) RegularPages() page.Pages

RegularPages returns all the regular pages. This is for the current language only.

type Permalinker

type Permalinker interface {
	Permalink() string
	RelPermalink() string
}

Permalinker provides permalinks of both the relative and absolute kind.

type Site

type Site struct {
	*PageCollections

	Sections Taxonomy
	Info     *SiteInfo

	// Logger etc.
	*deps.Deps `json:"-"`
	// contains filtered or unexported fields
}

Site contains all the information relevant for constructing a static site. The basic flow of information is as follows:

1. A list of Files is parsed and then converted into Pages.

  1. Pages contain sections (based on the file they were generated from), aliases and slugs (included in a pages frontmatter) which are the various targets that will get generated. There will be canonical listing. The canonical path can be overruled based on a pattern.

  2. Taxonomies are created via configuration and will present some aspect of the final page and typically a perm url.

  3. All Pages are passed through a template based on their desired layout based on numerous different elements.

5. The entire collection of files is written to disk.

func (*Site) Language

func (s *Site) Language() *langs.Language

type SiteInfo

type SiteInfo struct {
	// contains filtered or unexported fields
}

func (*SiteInfo) AllPages

func (s *SiteInfo) AllPages() page.Pages

func (*SiteInfo) AllRegularPages

func (s *SiteInfo) AllRegularPages() page.Pages

func (*SiteInfo) BaseURL

func (s *SiteInfo) BaseURL() template.URL

func (*SiteInfo) Current

func (s *SiteInfo) Current() page.Site

Current returns the currently rendered Site. If that isn't set yet, which is the situation before we start rendering, if will return the Site itself.

func (*SiteInfo) Data

func (s *SiteInfo) Data() map[string]any

func (*SiteInfo) Home

func (s *SiteInfo) Home() page.Page

Home is a shortcut to the home page, equivalent to .Site.GetPage "home".

func (*SiteInfo) Pages

func (s *SiteInfo) Pages() page.Pages

func (*SiteInfo) Params

func (s *SiteInfo) Params() maps.Params

func (*SiteInfo) RegularPages

func (s *SiteInfo) RegularPages() page.Pages

func (*SiteInfo) Sections

func (s *SiteInfo) Sections() page.Pages

Sections returns the top level sections.

func (*SiteInfo) Site

func (s *SiteInfo) Site() page.Site

func (*SiteInfo) Sites

func (s *SiteInfo) Sites() page.Sites

Sites is a convenience method to get all the Hugo sites/languages configured.

func (*SiteInfo) String

func (s *SiteInfo) String() string

func (*SiteInfo) Title

func (s *SiteInfo) Title() string

type Taxonomy

type Taxonomy map[string]page.WeightedPages

A Taxonomy is a map of keywords to a list of pages. For example

TagTaxonomy['technology'] = page.WeightedPages
TagTaxonomy['go']  =  page.WeightedPages

Directories

Path Synopsis
Package filesystems provides the fine grained file systems used by Hugo.
Package filesystems provides the fine grained file systems used by Hugo.

Jump to

Keyboard shortcuts

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