Documentation ¶
Index ¶
- func DefaultConfig() *allconfig.Config
- func ExampleConfig() (*allconfig.Config, error)
- type BuildCfg
- type ContentFactory
- func (f ContentFactory) ApplyArchetypeFi(w io.Writer, p page.Page, archetypeKind string, fi hugofs.FileMetaInfo) error
- func (f ContentFactory) ApplyArchetypeTemplate(w io.Writer, p page.Page, archetypeKind, templateSource string) error
- func (f ContentFactory) CreateContentPlaceHolder(filename string, force bool) (string, error)
- func (f ContentFactory) SectionFromFilename(filename string) (string, error)
- type HugoSites
- func (h *HugoSites) Build(config BuildCfg, events ...fsnotify.Event) error
- func (h *HugoSites) Data() map[string]any
- func (f HugoSites) Done() <-chan bool
- func (f HugoSites) FatalError(err error)
- func (h *HugoSites) GC() (int, error)
- func (h *HugoSites) GetContentPage(filename string) page.Page
- func (h *HugoSites) LanguageSet() map[string]int
- func (h *HugoSites) LogServerAddresses()
- func (h *HugoSites) NumLogErrors() int
- func (h *HugoSites) Pages() page.Pages
- func (h *HugoSites) PrintProcessingStats(w io.Writer)
- func (h *HugoSites) RegularPages() page.Pages
- func (h *HugoSites) ShouldSkipFileChangeEvent(ev fsnotify.Event) bool
- type IntegrationTestBuilder
- func NewIntegrationTestBuilder(conf IntegrationTestConfig) *IntegrationTestBuilder
- func Test(t testing.TB, files string, opts ...TestOpt) *IntegrationTestBuilder
- func TestE(t testing.TB, files string, opts ...TestOpt) (*IntegrationTestBuilder, error)
- func TestRunning(t testing.TB, files string, opts ...TestOpt) *IntegrationTestBuilder
- func (s *IntegrationTestBuilder) AddFiles(filenameContent ...string) *IntegrationTestBuilder
- func (s *IntegrationTestBuilder) AssertBuildCountData(count int)
- func (s *IntegrationTestBuilder) AssertBuildCountGitInfo(count int)
- func (s *IntegrationTestBuilder) AssertBuildCountLayouts(count int)
- func (s *IntegrationTestBuilder) AssertFileContent(filename string, matches ...string)
- func (s *IntegrationTestBuilder) AssertFileContentExact(filename string, matches ...string)
- func (s *IntegrationTestBuilder) AssertFileCount(dirname string, expected int)
- func (s *IntegrationTestBuilder) AssertFileExists(filename string, b bool)
- func (s *IntegrationTestBuilder) AssertFs(fs afero.Fs, matches ...string)
- func (s *IntegrationTestBuilder) AssertIsFileError(err error) herrors.FileError
- func (s *IntegrationTestBuilder) AssertLogContains(els ...string)
- func (s *IntegrationTestBuilder) AssertLogMatches(expression string)
- func (s *IntegrationTestBuilder) AssertLogNotContains(els ...string)
- func (s *IntegrationTestBuilder) AssertPublishDir(matches ...string)
- func (s *IntegrationTestBuilder) AssertRenderCountContent(count int)
- func (s *IntegrationTestBuilder) AssertRenderCountPage(count int)
- func (s *IntegrationTestBuilder) AssertRenderCountPageBetween(from, to int)
- func (s *IntegrationTestBuilder) Build() *IntegrationTestBuilder
- func (s *IntegrationTestBuilder) BuildE() (*IntegrationTestBuilder, error)
- func (s *IntegrationTestBuilder) EditFileReplaceAll(filename, old, new string) *IntegrationTestBuilder
- func (s *IntegrationTestBuilder) EditFileReplaceFunc(filename string, replacementFunc func(s string) string) *IntegrationTestBuilder
- func (s *IntegrationTestBuilder) EditFiles(filenameContent ...string) *IntegrationTestBuilder
- func (s *IntegrationTestBuilder) FileContent(filename string) string
- func (s *IntegrationTestBuilder) Init() *IntegrationTestBuilder
- func (s *IntegrationTestBuilder) LogString() string
- func (s *IntegrationTestBuilder) RemoveFiles(filenames ...string) *IntegrationTestBuilder
- func (s *IntegrationTestBuilder) RenameDir(old, new string) *IntegrationTestBuilder
- func (s *IntegrationTestBuilder) RenameFile(old, new string) *IntegrationTestBuilder
- type IntegrationTestConfig
- type IntegrationTestDebugConfig
- type Permalinker
- type ShortcodeWithPage
- func (scp *ShortcodeWithPage) Get(key any) any
- func (scp *ShortcodeWithPage) InnerDeindent() template.HTML
- func (scp *ShortcodeWithPage) Position() text.Position
- func (scp *ShortcodeWithPage) Ref(args map[string]any) (string, error)
- func (scp *ShortcodeWithPage) RelRef(args map[string]any) (string, error)
- func (scp *ShortcodeWithPage) Scratch() *maps.Scratch
- func (scp *ShortcodeWithPage) Site() page.Site
- func (scp *ShortcodeWithPage) Unwrapv() any
- type Site
- func (s *Site) AllPages() page.Pages
- func (s *Site) AllRegularPages() page.Pages
- func (s *Site) Author() map[string]anydeprecated
- func (s *Site) Authors() page.AuthorListdeprecated
- func (s *Site) BaseURL() string
- func (s *Site) BuildDrafts() bool
- func (s *Site) Config() page.SiteConfig
- func (s *Site) Copyright() string
- func (s *Site) Current() page.Site
- func (s *Site) Data() map[string]any
- func (s *Site) Debug()
- func (s *Site) DisqusShortname() stringdeprecated
- func (s *Site) ForEeachIdentityByName(name string, f func(identity.Identity) bool)
- func (s *Site) GetPage(ref ...string) (page.Page, error)
- func (s *Site) GetRelatedDocsHandler() *page.RelatedDocsHandler
- func (s *Site) GoogleAnalytics() stringdeprecated
- func (s *Site) Home() page.Page
- func (s *Site) Hugo() hugo.HugoInfo
- func (s *Site) IsMultiLingual() booldeprecated
- func (s *Site) IsServer() booldeprecated
- func (s *Site) Language() *langs.Language
- func (s *Site) LanguageCode() string
- func (s *Site) LanguagePrefix() string
- func (s *Site) Languages() langs.Languages
- func (s *Site) LastChange() time.Timedeprecated
- func (s *Site) Lastmod() time.Time
- func (s *Site) MainSections() []string
- func (s *Site) Menus() navigation.Menus
- func (s *Site) Pages() page.Pages
- func (s *Site) Param(key any) (any, error)
- func (s *Site) Params() maps.Params
- func (s *Site) RSSLink() template.URLdeprecated
- func (s *Site) RegisterMediaTypes()
- func (s *Site) RegularPages() page.Pages
- func (s *Site) Sections() page.Pages
- func (s *Site) ServerPort() int
- func (s *Site) Site() page.Site
- func (s *Site) SitemapAbsURL() string
- func (s *Site) Sites() page.Sites
- func (s *Site) Social() map[string]stringdeprecated
- func (s *Site) Taxonomies() page.TaxonomyList
- func (s *Site) Title() string
- type TestOpt
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultConfig ¶ added in v0.112.0
DefaultConfig returns the default configuration.
func ExampleConfig ¶ added in v0.112.0
ExampleConfig returns the some example configuration for documentation.
Types ¶
type BuildCfg ¶
type BuildCfg struct { // Skip rendering. Useful for testing. SkipRender bool // This is a partial re-render of some selected pages. PartialReRender bool // Set in server mode when the last build failed for some reason. ErrRecovery bool // Recently visited URLs. This is used for partial re-rendering. RecentlyVisited *types.EvictingStringQueue // Can be set to build only with a sub set of the content source. ContentInclusionFilter *glob.FilenameFilter // Set when the buildlock is already acquired (e.g. the archetype content builder). NoBuildLock bool // contains filtered or unexported fields }
BuildCfg holds build options used to, as an example, skip the render step.
type ContentFactory ¶ added in v0.89.0
type ContentFactory struct {
// contains filtered or unexported fields
}
ContentFactory creates content files from archetype templates.
func NewContentFactory ¶ added in v0.89.0
func NewContentFactory(h *HugoSites) ContentFactory
NewContentFactory creates a new ContentFactory for h.
func (ContentFactory) ApplyArchetypeFi ¶ added in v0.123.0
func (f ContentFactory) ApplyArchetypeFi(w io.Writer, p page.Page, archetypeKind string, fi hugofs.FileMetaInfo) error
ApplyArchetypeFilename archetypeFilename to w as a template using the given Page p as the foundation for the data context.
func (ContentFactory) ApplyArchetypeTemplate ¶ added in v0.95.0
func (f ContentFactory) ApplyArchetypeTemplate(w io.Writer, p page.Page, archetypeKind, templateSource string) error
ApplyArchetypeTemplate templateSource to w as a template using the given Page p as the foundation for the data context.
func (ContentFactory) CreateContentPlaceHolder ¶ added in v0.89.0
func (f ContentFactory) CreateContentPlaceHolder(filename string, force bool) (string, error)
CreateContentPlaceHolder creates a content placeholder file inside the best matching content directory.
func (ContentFactory) SectionFromFilename ¶ added in v0.89.0
func (f ContentFactory) SectionFromFilename(filename string) (string, error)
type HugoSites ¶
type HugoSites struct { Sites []*Site Configs *allconfig.Configs *deps.Deps // contains filtered or unexported fields }
HugoSites represents the sites to build. Each site represents a language.
func NewHugoSites ¶ added in v0.20.1
NewHugoSites creates HugoSites from the given config.
func (*HugoSites) Build ¶
Build builds all sites. If filesystem events are provided, this is considered to be a potential partial rebuild.
func (HugoSites) FatalError ¶ added in v0.55.0
func (f HugoSites) FatalError(err error)
FatalError error is used in some rare situations where it does not make sense to continue processing, to abort as soon as possible and log the error.
func (*HugoSites) GC ¶ added in v0.32.1
GC requires a build first and must run on it's own. It is not thread safe.
func (*HugoSites) GetContentPage ¶ added in v0.25.1
GetContentPage finds a Page with content given the absolute filename. Returns nil if none found.
func (*HugoSites) LanguageSet ¶ added in v0.49.1
TODO(bep) consolidate
func (*HugoSites) LogServerAddresses ¶ added in v0.125.5
func (h *HugoSites) LogServerAddresses()
func (*HugoSites) NumLogErrors ¶ added in v0.42.1
func (*HugoSites) PrintProcessingStats ¶ added in v0.32.1
func (*HugoSites) RegularPages ¶ added in v0.123.0
Pages returns all regularpages for all sites.
type IntegrationTestBuilder ¶ added in v0.92.2
type IntegrationTestBuilder struct { *qt.C H *HugoSites Cfg IntegrationTestConfig GCCount int // contains filtered or unexported fields }
IntegrationTestBuilder is a (partial) rewrite of sitesBuilder. The main problem with the "old" one was that it was that the test data was often a little hidden, so it became hard to look at a test and determine what it should do, especially coming back to the test after a year or so.
func NewIntegrationTestBuilder ¶ added in v0.92.2
func NewIntegrationTestBuilder(conf IntegrationTestConfig) *IntegrationTestBuilder
In most cases you should not use this function directly, but the Test or TestRunning function.
func Test ¶ added in v0.120.0
func Test(t testing.TB, files string, opts ...TestOpt) *IntegrationTestBuilder
Test is a convenience method to create a new IntegrationTestBuilder from some files and run a build.
func TestE ¶ added in v0.123.0
TestE is the same as Test, but returns an error instead of failing the test.
func TestRunning ¶ added in v0.120.0
func TestRunning(t testing.TB, files string, opts ...TestOpt) *IntegrationTestBuilder
TestRunning is a convenience method to create a new IntegrationTestBuilder from some files with Running set to true and run a build. Deprecated: Use Test with TestOptRunning instead.
func (*IntegrationTestBuilder) AddFiles ¶ added in v0.92.2
func (s *IntegrationTestBuilder) AddFiles(filenameContent ...string) *IntegrationTestBuilder
func (*IntegrationTestBuilder) AssertBuildCountData ¶ added in v0.92.2
func (s *IntegrationTestBuilder) AssertBuildCountData(count int)
func (*IntegrationTestBuilder) AssertBuildCountGitInfo ¶ added in v0.92.2
func (s *IntegrationTestBuilder) AssertBuildCountGitInfo(count int)
func (*IntegrationTestBuilder) AssertBuildCountLayouts ¶ added in v0.92.2
func (s *IntegrationTestBuilder) AssertBuildCountLayouts(count int)
func (*IntegrationTestBuilder) AssertFileContent ¶ added in v0.92.2
func (s *IntegrationTestBuilder) AssertFileContent(filename string, matches ...string)
func (*IntegrationTestBuilder) AssertFileContentExact ¶ added in v0.94.1
func (s *IntegrationTestBuilder) AssertFileContentExact(filename string, matches ...string)
func (*IntegrationTestBuilder) AssertFileCount ¶ added in v0.116.0
func (s *IntegrationTestBuilder) AssertFileCount(dirname string, expected int)
func (*IntegrationTestBuilder) AssertFileExists ¶ added in v0.120.4
func (s *IntegrationTestBuilder) AssertFileExists(filename string, b bool)
func (*IntegrationTestBuilder) AssertFs ¶ added in v0.123.2
func (s *IntegrationTestBuilder) AssertFs(fs afero.Fs, matches ...string)
func (*IntegrationTestBuilder) AssertIsFileError ¶ added in v0.92.2
func (s *IntegrationTestBuilder) AssertIsFileError(err error) herrors.FileError
func (*IntegrationTestBuilder) AssertLogContains ¶ added in v0.92.2
func (s *IntegrationTestBuilder) AssertLogContains(els ...string)
func (*IntegrationTestBuilder) AssertLogMatches ¶ added in v0.96.0
func (s *IntegrationTestBuilder) AssertLogMatches(expression string)
func (*IntegrationTestBuilder) AssertLogNotContains ¶ added in v0.123.0
func (s *IntegrationTestBuilder) AssertLogNotContains(els ...string)
func (*IntegrationTestBuilder) AssertPublishDir ¶ added in v0.123.0
func (s *IntegrationTestBuilder) AssertPublishDir(matches ...string)
func (*IntegrationTestBuilder) AssertRenderCountContent ¶ added in v0.92.2
func (s *IntegrationTestBuilder) AssertRenderCountContent(count int)
func (*IntegrationTestBuilder) AssertRenderCountPage ¶ added in v0.92.2
func (s *IntegrationTestBuilder) AssertRenderCountPage(count int)
func (*IntegrationTestBuilder) AssertRenderCountPageBetween ¶ added in v0.123.0
func (s *IntegrationTestBuilder) AssertRenderCountPageBetween(from, to int)
func (*IntegrationTestBuilder) Build ¶ added in v0.92.2
func (s *IntegrationTestBuilder) Build() *IntegrationTestBuilder
func (*IntegrationTestBuilder) BuildE ¶ added in v0.92.2
func (s *IntegrationTestBuilder) BuildE() (*IntegrationTestBuilder, error)
func (*IntegrationTestBuilder) EditFileReplaceAll ¶ added in v0.123.0
func (s *IntegrationTestBuilder) EditFileReplaceAll(filename, old, new string) *IntegrationTestBuilder
func (*IntegrationTestBuilder) EditFileReplaceFunc ¶ added in v0.123.0
func (s *IntegrationTestBuilder) EditFileReplaceFunc(filename string, replacementFunc func(s string) string) *IntegrationTestBuilder
func (*IntegrationTestBuilder) EditFiles ¶ added in v0.92.2
func (s *IntegrationTestBuilder) EditFiles(filenameContent ...string) *IntegrationTestBuilder
func (*IntegrationTestBuilder) FileContent ¶ added in v0.92.2
func (s *IntegrationTestBuilder) FileContent(filename string) string
func (*IntegrationTestBuilder) Init ¶ added in v0.116.0
func (s *IntegrationTestBuilder) Init() *IntegrationTestBuilder
func (*IntegrationTestBuilder) LogString ¶ added in v0.115.0
func (s *IntegrationTestBuilder) LogString() string
func (*IntegrationTestBuilder) RemoveFiles ¶ added in v0.92.2
func (s *IntegrationTestBuilder) RemoveFiles(filenames ...string) *IntegrationTestBuilder
func (*IntegrationTestBuilder) RenameDir ¶ added in v0.123.0
func (s *IntegrationTestBuilder) RenameDir(old, new string) *IntegrationTestBuilder
func (*IntegrationTestBuilder) RenameFile ¶ added in v0.92.2
func (s *IntegrationTestBuilder) RenameFile(old, new string) *IntegrationTestBuilder
type IntegrationTestConfig ¶ added in v0.92.2
type IntegrationTestConfig struct { T testing.TB // The files to use on txtar format, see // https://pkg.go.dev/golang.org/x/exp/cmd/txtar TxtarString string // COnfig to use as the base. We will also read the config from the txtar. BaseCfg config.Provider // Environment variables passed to the config loader. Environ []string // Whether to simulate server mode. Running bool // Watch for changes. // This is (currently) always set to true when Running is set. // Note that the CLI for the server does allow for --watch=false, but that is not used in these test. Watching bool // Will print the log buffer after the build Verbose bool // The log level to use. LogLevel logg.Level // Whether it needs the real file system (e.g. for js.Build tests). NeedsOsFS bool // Whether to run GC after each build. RunGC bool // Do not remove the temp dir after the test. PrintAndKeepTempDir bool // Whether to run npm install before Build. NeedsNpmInstall bool // Whether to normalize the Unicode filenames to NFD on Darwin. NFDFormOnDarwin bool // The working dir to use. If not absolute, a temp dir will be created. WorkingDir string // The config to pass to Build. BuildCfg BuildCfg }
type IntegrationTestDebugConfig ¶ added in v0.92.2
type Permalinker ¶ added in v0.20.1
Permalinker provides permalinks of both the relative and absolute kind.
type ShortcodeWithPage ¶
type ShortcodeWithPage struct { Params any Inner template.HTML Page page.Page Parent *ShortcodeWithPage Name string IsNamedParams bool // Zero-based ordinal in relation to its parent. If the parent is the page itself, // this ordinal will represent the position of this shortcode in the page content. Ordinal int // contains filtered or unexported fields }
ShortcodeWithPage is the "." context in a shortcode template.
func (*ShortcodeWithPage) Get ¶
func (scp *ShortcodeWithPage) Get(key any) any
Get is a convenience method to look up shortcode parameters by its key.
func (*ShortcodeWithPage) InnerDeindent ¶ added in v0.100.0
func (scp *ShortcodeWithPage) InnerDeindent() template.HTML
InnerDeindent returns the (potentially de-indented) inner content of the shortcode.
func (*ShortcodeWithPage) Position ¶ added in v0.54.0
func (scp *ShortcodeWithPage) Position() text.Position
Position returns this shortcode's detailed position. Note that this information may be expensive to calculate, so only use this in error situations.
func (*ShortcodeWithPage) Ref ¶
func (scp *ShortcodeWithPage) Ref(args map[string]any) (string, error)
Ref is a shortcut to the Ref method on Page. It passes itself as a context to get better error messages.
func (*ShortcodeWithPage) RelRef ¶
func (scp *ShortcodeWithPage) RelRef(args map[string]any) (string, error)
RelRef is a shortcut to the RelRef method on Page. It passes itself as a context to get better error messages.
func (*ShortcodeWithPage) Scratch ¶
func (scp *ShortcodeWithPage) Scratch() *maps.Scratch
Scratch returns a scratch-pad scoped for this shortcode. This can be used as a temporary storage for variables, counters etc.
func (*ShortcodeWithPage) Site ¶
func (scp *ShortcodeWithPage) Site() page.Site
Site returns information about the current site.
func (*ShortcodeWithPage) Unwrapv ¶ added in v0.123.0
func (scp *ShortcodeWithPage) Unwrapv() any
For internal use only.
type Site ¶
func (*Site) AllRegularPages ¶ added in v0.123.0
AllRegularPages returns all regular pages for all sites.
func (*Site) Authors
deprecated
added in
v0.112.0
func (s *Site) Authors() page.AuthorList
Deprecated: Use taxonomies instead.
func (*Site) BuildDrafts ¶ added in v0.112.0
func (*Site) Config ¶ added in v0.112.0
func (s *Site) Config() page.SiteConfig
func (*Site) DisqusShortname
deprecated
added in
v0.112.0
func (*Site) ForEeachIdentityByName ¶ added in v0.123.0
func (*Site) GetPage ¶ added in v0.112.0
GetPage looks up a page of a given type for the given ref. In Hugo <= 0.44 you had to add Page Kind (section, home) etc. as the first argument and then either a unix styled path (with or without a leading slash)) or path elements separated. When we now remove the Kind from this API, we need to make the transition as painless as possible for existing sites. Most sites will use {{ .Site.GetPage "section" "my/section" }}, i.e. 2 arguments, so we test for that.
func (*Site) GetRelatedDocsHandler ¶ added in v0.55.0
func (s *Site) GetRelatedDocsHandler() *page.RelatedDocsHandler
func (*Site) GoogleAnalytics
deprecated
added in
v0.112.0
func (*Site) Home ¶ added in v0.112.0
Home is a shortcut to the home page, equivalent to .Site.GetPage "home".
func (*Site) IsMultiLingual
deprecated
added in
v0.112.0
func (*Site) LanguageCode ¶ added in v0.112.0
func (*Site) LanguagePrefix ¶ added in v0.112.0
func (*Site) LastChange
deprecated
added in
v0.112.0
func (*Site) MainSections ¶ added in v0.112.0
MainSections returns the list of main sections.
func (*Site) Menus ¶
func (s *Site) Menus() navigation.Menus
func (*Site) Pages ¶ added in v0.123.0
Pages returns all pages. This is for the current language only.
func (*Site) RegisterMediaTypes ¶ added in v0.20.1
func (s *Site) RegisterMediaTypes()
RegisterMediaTypes will register the Site's media types in the mime package, so it will behave correctly with Hugo's built-in server.
func (*Site) RegularPages ¶ added in v0.123.0
RegularPages returns all the regular pages. This is for the current language only.
func (*Site) ServerPort ¶ added in v0.112.0
Returns the server port.
func (*Site) SitemapAbsURL ¶ added in v0.112.0
SitemapAbsURL is a convenience method giving the absolute URL to the sitemap.
func (*Site) Taxonomies ¶
func (s *Site) Taxonomies() page.TaxonomyList
type TestOpt ¶ added in v0.123.0
type TestOpt func(*IntegrationTestConfig)
func TestOptDebug ¶ added in v0.123.0
func TestOptDebug() TestOpt
TestOptDebug will enable debug logging in integration tests.
func TestOptRunning ¶ added in v0.123.0
func TestOptRunning() TestOpt
TestOptRunning will enable running in integration tests.
func TestOptTrace ¶ added in v0.123.0
func TestOptTrace() TestOpt
Enable tracing in integration tests. THis should only be used during development and not committed to the repo.
func TestOptWarn ¶ added in v0.123.0
func TestOptWarn() TestOpt
TestOptWarn will enable warn logging in integration tests.
func TestOptWatching ¶ added in v0.125.4
func TestOptWatching() TestOpt
TestOptWatching will enable watching in integration tests.
func TestOptWithConfig ¶ added in v0.123.0
func TestOptWithConfig(fn func(c *IntegrationTestConfig)) TestOpt
TestOptWithWorkingDir allows setting any config optiona as a function al option.
func TestOptWithNFDOnDarwin ¶ added in v0.123.0
func TestOptWithNFDOnDarwin() TestOpt
TestOptWithNFDOnDarwin will normalize the Unicode filenames to NFD on Darwin.
Source Files ¶
- alias.go
- codeowners.go
- collections.go
- config.go
- content_factory.go
- content_map.go
- content_map_page.go
- fileInfo.go
- gitinfo.go
- hugo_sites.go
- hugo_sites_build.go
- integrationtest_builder.go
- page.go
- page__common.go
- page__content.go
- page__data.go
- page__menus.go
- page__meta.go
- page__new.go
- page__output.go
- page__paginator.go
- page__paths.go
- page__per_output.go
- page__position.go
- page__ref.go
- page__tree.go
- page_kinds.go
- page_unwrap.go
- pagecollections.go
- pages_capture.go
- permalinker.go
- prune_resources.go
- shortcode.go
- shortcode_page.go
- site.go
- site_new.go
- site_output.go
- site_render.go
- site_sections.go
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. |