paths

package
v0.47.1 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2018 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var FilePathSeparator = string(filepath.Separator)

Functions

func AbsPathify

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.

Types

type BaseURL

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 added in v0.45.1

func (b BaseURL) HostURL() string

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

func (BaseURL) Path

func (b BaseURL) Path() string

func (BaseURL) String

func (b BaseURL) String() string

func (BaseURL) URL

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

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

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.
	// This will not be set if canonifyURLs is enabled.
	BasePath string

	// Directories
	// TODO(bep) when we have trimmed down mos of the dirs usage outside of this package, make
	// these into an interface.
	ContentDir string
	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

	DefaultContentLanguage string

	AllThemes []ThemeConfig
	// contains filtered or unexported fields
}

func New

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

func (*Paths) AbsPathify

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) GetLangSubDir

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

GetLangSubDir returns the given language's subdir if needed.

func (*Paths) GetLanguagePrefix

func (p *Paths) GetLanguagePrefix() string

func (*Paths) GetTargetLanguageBasePath added in v0.45.1

func (p *Paths) GetTargetLanguageBasePath() string

func (*Paths) GetURLLanguageBasePath added in v0.45.1

func (p *Paths) GetURLLanguageBasePath() string

func (*Paths) Lang

func (p *Paths) Lang() string

func (*Paths) ThemeSet

func (p *Paths) ThemeSet() bool

ThemeSet checks whether a theme is in use or not.

func (*Paths) Themes

func (p *Paths) Themes() []string

type ThemeConfig

type ThemeConfig struct {
	// The theme name as provided by the folder name below /themes.
	Name string

	// Optional configuration filename (e.g. "/themes/mytheme/config.json").
	ConfigFilename string

	// Optional config read from the ConfigFile above.
	Cfg config.Provider
}

func CollectThemes

func CollectThemes(fs afero.Fs, themesDir string, themes []string) ([]ThemeConfig, error)

Jump to

Keyboard shortcuts

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