hugo: github.com/gohugoio/hugo/hugolib/paths Index | Files

package paths

import "github.com/gohugoio/hugo/hugolib/paths"

Index

Package Files

baseURL.go paths.go

Variables

var FilePathSeparator = string(filepath.Separator)

func AbsPathify Uses

func AbsPathify(workingDir, inPath string) string

AbsPathify creates an absolute path if given a working dir and arelative path. If already absolute, the path is just cleaned.

type BaseURL Uses

type BaseURL struct {
    // 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 (BaseURL) HostURL Uses

func (b BaseURL) HostURL() string

HostURL returns the URL to the host root without any path elements.

func (BaseURL) Path Uses

func (b BaseURL) Path() string

func (BaseURL) String Uses

func (b BaseURL) String() string

func (BaseURL) URL Uses

func (b BaseURL) URL() *url.URL

URL returns a copy of the internal URL. The copy can be safely used and modified.

func (BaseURL) WithProtocol Uses

func (b BaseURL) WithProtocol(protocol string) (string, error)

WithProtocol returns the BaseURL prefixed with the given protocol. The Protocol is normally of the form "scheme://", i.e. "webcal://".

type Paths Uses

type Paths struct {
    Fs  *hugofs.Fs
    Cfg config.Provider

    BaseURL

    // If the baseURL contains a base path, e.g. https://example.com/docs, then "/docs" will be the BasePath.
    BasePath string

    // Directories
    // TODO(bep) when we have trimmed down mos of the dirs usage outside of this package, make
    // these into an interface.
    ThemesDir  string
    WorkingDir string

    // Directories to store Resource related artifacts.
    AbsResourcesDir string

    AbsPublishDir string

    // pagination path handling
    PaginatePath string

    PublishDir string

    // When in multihost mode, this returns a list of base paths below PublishDir
    // for each language.
    MultihostTargetBasePaths []string

    DisablePathToLower bool
    RemovePathAccents  bool
    UglyURLs           bool
    CanonifyURLs       bool

    Language              *langs.Language
    Languages             langs.Languages
    LanguagesDefaultFirst langs.Languages

    DefaultContentLanguage string

    AllModules    modules.Modules
    ModulesClient *modules.Client
    // contains filtered or unexported fields
}

func New Uses

func New(fs *hugofs.Fs, cfg config.Provider) (*Paths, error)

func (*Paths) AbsPathify Uses

func (p *Paths) AbsPathify(inPath string) string

AbsPathify creates an absolute path if given a relative path. If already absolute, the path is just cleaned.

func (*Paths) GetBasePath Uses

func (p *Paths) GetBasePath(isRelativeURL bool) string

GetBasePath returns any path element in baseURL if needed.

func (*Paths) GetLangSubDir Uses

func (p *Paths) GetLangSubDir(lang string) string

GetLangSubDir returns the given language's subdir if needed.

func (*Paths) GetLanguagePrefix Uses

func (p *Paths) GetLanguagePrefix() string

func (*Paths) GetTargetLanguageBasePath Uses

func (p *Paths) GetTargetLanguageBasePath() string

func (*Paths) GetURLLanguageBasePath Uses

func (p *Paths) GetURLLanguageBasePath() string

func (*Paths) Lang Uses

func (p *Paths) Lang() string

func (*Paths) RelPathify Uses

func (p *Paths) RelPathify(filename string) string

RelPathify trims any WorkingDir prefix from the given filename. If the filename is not considered to be absolute, the path is just cleaned.

Package paths imports 9 packages (graph) and is imported by 68 packages. Updated 2020-01-04. Refresh now. Tools for package owners.