Documentation ¶
Index ¶
- func AddTrailingSlash(path string) string
- func BytesToHTML(b []byte) template.HTML
- func MD5String(f string) string
- func NewZeroFile() hugosites.File
- func OpenFileForWriting(fs afero.Fs, filename string) (afero.File, error)
- type ContentMap
- type ContentTree
- type ContentTrees
- type DestinationPublisher
- type FileInfo
- func (fi *FileInfo) BaseFileName() string
- func (fi *FileInfo) ContentBaseName() string
- func (fi *FileInfo) Dir() string
- func (fi *FileInfo) Ext() string
- func (fi *FileInfo) Extension() string
- func (fi *FileInfo) FileInfo() fsVO.FileMetaInfo
- func (fi *FileInfo) Filename() string
- func (fi *FileInfo) IsZero() bool
- func (fi *FileInfo) LogicalName() string
- func (fi *FileInfo) Path() string
- func (fi *FileInfo) Section() string
- func (fi *FileInfo) TranslationBaseName() string
- func (fi *FileInfo) UniqueID() string
- type HugoSites
- type PageCollections
- type PageMap
- type Site
- type TargetPathDescriptor
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddTrailingSlash ¶
AddTrailingSlash adds a trailing Unix styled slash (/) if not already there.
func BytesToHTML ¶
BytesToHTML converts bytes to type template.HTML.
func NewZeroFile ¶
Types ¶
type ContentMap ¶
type ContentMap struct { // View of regular pages, sections, and taxonomies. PageTrees ContentTrees // View of pages, sections, taxonomies, and resources. BundleTrees ContentTrees // Stores page bundles keyed by its path's directory or the base filename, // e.g. "blog/post.md" => "/blog/post", "blog/post/index.md" => "/blog/post" // These are the "regular pages" and all of them are bundles. Pages *ContentTree // Section nodes. Sections *ContentTree }
func (*ContentMap) AddFilesBundle ¶
func (m *ContentMap) AddFilesBundle(header fsVO.FileMetaInfo) error
func (*ContentMap) CreateMissingNodes ¶
func (m *ContentMap) CreateMissingNodes() error
type ContentTree ¶
type ContentTrees ¶
type ContentTrees []*ContentTree
func (ContentTrees) Walk ¶
func (c ContentTrees) Walk(fn contentTreeNodeCallback)
type DestinationPublisher ¶
DestinationPublisher is the default and currently only publisher in Hugo. This publisher prepares and publishes an item to the defined destination, e.g. /public.
func (*DestinationPublisher) Publish ¶
func (p *DestinationPublisher) Publish(d hugosites.Descriptor) error
Publish applies any relevant transformations and writes the file to its destination, e.g. /public.
type FileInfo ¶
type FileInfo struct {
// contains filtered or unexported fields
}
FileInfo describes a source file.
func NewFileInfo ¶
func NewFileInfo(fi fsVO.FileMetaInfo) (*FileInfo, error)
func (*FileInfo) BaseFileName ¶
BaseFileName returns a file's name without extension (ie. "page.sv").
func (*FileInfo) ContentBaseName ¶
ContentBaseName is a either TranslationBaseName or name of containing folder if file is a leaf bundle.
func (*FileInfo) Dir ¶
Dir gets the name of the directory that contains this file. The directory is relative to the content root.
func (*FileInfo) FileInfo ¶
func (fi *FileInfo) FileInfo() fsVO.FileMetaInfo
FileInfo returns a file's underlying os.FileInfo.
func (*FileInfo) LogicalName ¶
LogicalName returns a file's name and extension (ie. "page.sv.md").
func (*FileInfo) Path ¶
Path gets the relative path including file name and extension. The directory is relative to the content root.
func (*FileInfo) TranslationBaseName ¶
TranslationBaseName returns a file's translation base name without the language segment (ie. "page").
type HugoSites ¶
type PageCollections ¶
type PageCollections struct {
PageMap *PageMap
}
PageCollections contains the page collections for a site.
type PageMap ¶
type PageMap struct { S *Site *ContentMap }
func (*PageMap) AssemblePages ¶
func (*PageMap) AssembleSections ¶
type Site ¶
type Site struct { deps.Deps // The owning container. When multiple languages, there will be multiple // sites . H *HugoSites Language *langEntity.Language // Output formats defined in site config per Page Kind, or some defaults // if not set. // Output formats defined in Page front matter will override these. OutputFormats map[string]valueobject.Formats // The output formats that we need to render this site in. This slice // will be fixed once set. // This will be the union of Site.Pages' outputFormats. // This slice will be sorted. RenderFormats valueobject.Formats // All the output formats and media types available for this site. // These values will be merged from the Hugo defaults, the site config and, // finally, the language settings. OutputFormatsConfig valueobject.Formats MediaTypesConfig valueobject.Types Publisher hugosites.Publisher *PageCollections }
type TargetPathDescriptor ¶
type TargetPathDescriptor struct { Type valueobject.Format Kind string Sections []string // For regular content pages this is either // 1) the Slug, if set, // 2) the file base name (TranslationBaseName). BaseName string // Source directory. Dir string // Typically a language prefix added to file paths. PrefixFilePath string // Typically a language prefix added to links. PrefixLink string // If in multihost mode etc., every link/path needs to be prefixed, even // if set in URL. ForcePrefix bool // URL from front matter if set. Will override any Slug etc. URL string // The expanded permalink if defined for the section, ready to use. ExpandedPermalink string }
TargetPathDescriptor describes how a file path for a given resource should look like on the file system. The same descriptor is then later used to create both the permalinks and the relative links, paginator URLs etc.
The big motivating behind this is to have only one source of truth for URLs, and by that also get rid of most of the fragile string parsing/encoding etc.