Documentation ¶
Index ¶
- Constants
- func AddContextRoot(baseURL, relativePath string) string
- func AddTrailingSlash(path string) string
- func Ext(in string) string
- func ExtNoDelimiter(in string) string
- func FileAndExt(in string) (string, string)
- func FileAndExtNoDelimiter(in string) (string, string)
- func Filename(in string) (name string)
- func FindCWD() (string, error)
- func GetDottedRelativePath(inPath string) string
- func GetRelativePath(path, base string) (final string, err error)
- func IsAbsURL(path string) bool
- func MakePermalink(host, plink string) *url.URL
- func MakeTitle(inpath string) string
- func PathAndExt(in string) (string, string)
- func PathNoExt(in string) string
- func PathPrep(ugly bool, in string) string
- func PrettifyPath(in string) string
- func PrettifyURL(in string) string
- func PrettifyURLPath(in string) string
- func ReplaceExtension(path string, newExt string) string
- func SanitizeURL(in string) string
- func SanitizeURLKeepTrailingSlash(in string) string
- func ToSlashTrimLeading(s string) string
- func Uglify(in string) string
- type NamedSlice
Constants ¶
const FilePathSeparator = string(filepath.Separator)
FilePathSeparator as defined by os.Separator.
Variables ¶
This section is empty.
Functions ¶
func AddContextRoot ¶
AddContextRoot adds the context root to an URL if it's not already set. For relative URL entries on sites with a base url with a context root set (i.e. http://example.com/mysite), relative URLs must not include the context root if canonifyURLs is enabled. But if it's disabled, it must be set.
func AddTrailingSlash ¶
AddTrailingSlash adds a trailing Unix styled slash (/) if not already there.
func ExtNoDelimiter ¶
ExtNoDelimiter takes a path and returns the extension, excluding the delimiter, i.e. "md".
func FileAndExt ¶
FileAndExt takes a path and returns the file and extension separated, the extension including the delimiter, i.e. ".md".
func FileAndExtNoDelimiter ¶
FileAndExtNoDelimiter takes a path and returns the file and extension separated, the extension excluding the delimiter, e.g "md".
func Filename ¶
Filename takes a file path, strips out the extension, and returns the name of the file.
func GetDottedRelativePath ¶
GetDottedRelativePath expects a relative path starting after the content directory. It returns a relative path with dots ("..") navigating up the path structure.
func GetRelativePath ¶
GetRelativePath returns the relative path of a given path.
func MakePermalink ¶
MakePermalink combines base URL with content path to create full URL paths. Example
base: http://spf13.com/ path: post/how-i-blog result: http://spf13.com/post/how-i-blog
func MakeTitle ¶
MakeTitle converts the path given to a suitable title, trimming whitespace and replacing hyphens with whitespace.
func PathAndExt ¶
PathAndExt is the same as FileAndExt, but it uses the path package.
func PathNoExt ¶
PathNoExt takes a path, strips out the extension, and returns the name of the file.
func PathPrep ¶
PathPrep prepares the path using the uglify setting to create paths on either the form /section/name/index.html or /section/name.html.
func PrettifyPath ¶
PrettifyPath is the same as PrettifyURLPath but for file paths.
/section/name.html becomes /section/name/index.html /section/name/ becomes /section/name/index.html /section/name/index.html becomes /section/name/index.html
func PrettifyURL ¶
PrettifyURL takes a URL string and returns a semantic, clean URL.
func PrettifyURLPath ¶
PrettifyURLPath takes a URL path to a content and converts it to enable pretty URLs.
/section/name.html becomes /section/name/index.html /section/name/ becomes /section/name/index.html /section/name/index.html becomes /section/name/index.html
func ReplaceExtension ¶
ReplaceExtension takes a path and an extension, strips the old extension and returns the path with the new extension.
func SanitizeURLKeepTrailingSlash ¶
SanitizeURLKeepTrailingSlash is the same as SanitizeURL, but will keep any trailing slash.
func ToSlashTrimLeading ¶
ToSlashTrimLeading is just a filepath.ToSlash with an added / prefix trimmer.
Types ¶
type NamedSlice ¶
func (NamedSlice) String ¶
func (n NamedSlice) String() string