Documentation ¶
Index ¶
- type Author
- type BaseURL
- func (b BaseURL) GetRoot(path string) string
- func (b BaseURL) HostURL() string
- func (b BaseURL) Path() string
- func (b BaseURL) Port() int
- func (b BaseURL) String() string
- func (b BaseURL) URL() *url.URL
- func (b BaseURL) WithPort(port int) (BaseURL, error)
- func (b BaseURL) WithProtocol(protocol string) (BaseURL, error)
- type Compiler
- type GitInfo
- type GitMap
- type Menu
- type MenuConfig
- type MenuEntry
- type Menus
- type OutputFormat
- type OutputFormats
- type PagePaths
- type TargetPathDescriptor
- type TargetPaths
- type TargetPathsHolder
- type TemplateDescriptor
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseURL ¶
type BaseURL struct { WithPath string WithPathNoTrailingSlash string WithoutPath string BasePath string BasePathNoTrailingSlash string // contains filtered or unexported fields }
A BaseURL in Hugo is normally on the form scheme://path, but the form scheme: is also valid (mailto:hugo@rules.com).
func NewBaseURLFromString ¶
type Compiler ¶
type Compiler struct {
// contains filtered or unexported fields
}
func NewVersion ¶
type GitInfo ¶
type GitInfo struct { // Commit hash. Hash string `json:"hash"` // Abbreviated commit hash. AbbreviatedHash string `json:"abbreviatedHash"` // The commit message's subject/title line. Subject string `json:"subject"` // The author name, respecting .mailmap. AuthorName string `json:"authorName"` // The author email address, respecting .mailmap. AuthorEmail string `json:"authorEmail"` // The author date. AuthorDate time.Time `json:"authorDate"` // The commit date. CommitDate time.Time `json:"commitDate"` }
GitInfo provides information about a version controlled source file.
func NewGitInfo ¶
type MenuConfig ¶
type MenuConfig struct { Identifier string Parent string Name string Pre template.HTML Post template.HTML URL string PageRef string Weight int Title string // User defined params. Params maps.Params }
MenuConfig holds the configuration for a menu.
type MenuEntry ¶
type MenuEntry struct { // The menu entry configuration. MenuConfig // The menu containing this menu entry. Menu string // The URL value from front matter / config. ConfiguredURL string // Child entries. Children Menu // TODO, removed Page *MenuEntry }
MenuEntry represents a menu item defined in either Page front matter or in the site config.
type OutputFormat ¶
type OutputFormat struct { // Rel contains a value that can be used to construct a rel link. // This is value is fetched from the output format definition. // Note that for pages with only one output format, // this method will always return "canonical". // As an example, the AMP output format will, by default, return "amphtml". // // See: // https://www.ampproject.org/docs/guides/deploy/discovery // // Most other output formats will have "alternate" as value for this. Rel string Format output.Format // contains filtered or unexported fields }
OutputFormat links to a representation of a resource.
func NewOutputFormat ¶
func NewOutputFormat(relPermalink, permalink string, f output.Format) OutputFormat
func (OutputFormat) Permalink ¶
func (o OutputFormat) Permalink() string
Permalink returns the absolute permalink to this output format.
func (OutputFormat) RelPermalink ¶
func (o OutputFormat) RelPermalink() string
RelPermalink returns the relative permalink to this output format.
type OutputFormats ¶
type OutputFormats []OutputFormat
OutputFormats holds a list of the relevant output formats for a given page.
func (OutputFormats) Get ¶
func (o OutputFormats) Get(name string) *OutputFormat
Get gets a OutputFormat given its name, i.e. json, html etc. It returns nil if none found.
type PagePaths ¶
type PagePaths struct { TargetPaths map[string]TargetPathsHolder // contains filtered or unexported fields }
func NewPagePaths ¶
func (PagePaths) OutputFormats ¶
func (l PagePaths) OutputFormats() OutputFormats
type TargetPathDescriptor ¶
type TargetPathDescriptor struct { Type output.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.
type TargetPaths ¶
type TargetPaths struct { // Where to store the file on disk relative to the publish dir. OS slashes. TargetFilename string // The directory to write sub-resources of the above. SubResourceBaseTarget string // The base for creating links to sub-resources of the above. SubResourceBaseLink string // The relative permalink to this resources. Unix slashes. Link string }
func (TargetPaths) GetBasePath ¶
func (p TargetPaths) GetBasePath(isRelativeURL bool) string
GetBasePath returns any path element in baseURL if needed.
func (TargetPaths) PermalinkForBaseURL ¶
func (p TargetPaths) PermalinkForBaseURL(link, baseURL string) string
PermalinkForBaseURL creates a permalink from the given link and baseURL.
func (TargetPaths) PermalinkForOutputFormat ¶
func (p TargetPaths) PermalinkForOutputFormat() string
func (TargetPaths) PrependBasePath ¶
func (p TargetPaths) PrependBasePath(rel string, isAbs bool) string
PrependBasePath prepends any baseURL sub-folder to the given resource
func (TargetPaths) RelPermalink ¶
func (p TargetPaths) RelPermalink() string
type TargetPathsHolder ¶
type TargetPathsHolder struct { Paths TargetPaths OutputFormat }
func (TargetPathsHolder) TargetPaths ¶
func (t TargetPathsHolder) TargetPaths() TargetPaths
type TemplateDescriptor ¶
type TemplateDescriptor struct {
// contains filtered or unexported fields
}
func NewTemplateDescriptor ¶
func NewTemplateDescriptor(name, ext string) *TemplateDescriptor
func (*TemplateDescriptor) Extension ¶
func (td *TemplateDescriptor) Extension() string
func (*TemplateDescriptor) Name ¶
func (td *TemplateDescriptor) Name() string