Documentation ¶
Index ¶
- Constants
- func AbsPathify(workingDir, inPath string) string
- func AddContextRoot(baseURL, relativePath 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 GetDottedRelativePath(inPath string) string
- func GetRelativePath(path, base string) (final string, err error)
- func MakePermalink(host, plink string) *url.URL
- func MakeTitle(inpath string) string
- func PathAndExt(in string) (string, string)
- func PathNoExt(in string) string
- func PrettifyURL(in string) string
- func PrettifyURLPath(in string) string
- func ReplaceExtension(path string, newExt string) string
- func Uglify(in string) string
- func UrlToFilename(s string) (string, bool)
- type NamedSlice
Constants ¶
const FilePathSeparator = string(filepath.Separator)
FilePathSeparator as defined by os.Separator.
Variables ¶
This section is empty.
Functions ¶
func AbsPathify ¶ added in v0.97.0
AbsPathify creates an absolute path if given a working dir and a relative path. If already absolute, the path is just cleaned.
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 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 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 Uglify ¶
Uglify does the opposite of PrettifyURLPath().
/section/name/index.html becomes /section/name.html /section/name/ becomes /section/name.html /section/name.html becomes /section/name.html
func UrlToFilename ¶ added in v0.99.0
UrlToFilename converts the URL s to a filename. If ParseRequestURI fails, the input is just converted to OS specific slashes and returned.
Types ¶
type NamedSlice ¶
func (NamedSlice) String ¶
func (n NamedSlice) String() string