hakyll-2.4.4: A simple static site generator library.

Text.Hakyll.File

Description

A module containing various function for manipulating and examinating files and directories.

Synopsis

Documentation

toDestination :: FilePath -> Hakyll FilePathSource

Convert a relative URL to a filepath in the destination (default: _site).

toCache :: FilePath -> Hakyll FilePathSource

Convert a relative URL to a filepath in the cache (default: _cache).

toUrl :: FilePath -> Hakyll FilePathSource

Get the url for a given page. For most extensions, this would be the path itself. It's only for rendered extensions (.markdown, .rst, .lhs this function returns a path with a .html extension instead.

toRoot :: FilePath -> FilePathSource

Get the relative url to the site root, for a given (absolute) url

inDirectorySource

Arguments

:: FilePath

File path

-> FilePath

Directory

-> Bool

Result

Check if a file is in a given directory.

inHakyllDirectory :: FilePath -> Hakyll BoolSource

Check if a file is in a Hakyll directory. With a Hakyll directory, we mean a directory that should be ignored such as the _site or _cache directory.

Example:

 inHakyllDirectory "_cache/pages/index.html"

Result:

 True

removeSpaces :: FilePath -> FilePathSource

Swaps spaces for -.

makeDirectories :: FilePath -> Hakyll ()Source

Given a path to a file, try to make the path writable by making all directories on the path.

getRecursiveContents :: FilePath -> Hakyll [FilePath]Source

Get all contents of a directory. Note that files starting with a dot (.) will be ignored.

sortByBaseName :: [FilePath] -> [FilePath]Source

Sort a list of filenames on the basename.

havingExtension :: String -> [FilePath] -> [FilePath]Source

A filter that takes all file names with a given extension. Prefix the extension with a dot:

 havingExtension ".markdown" [ "index.markdown"
                             , "style.css"
                             ] == ["index.markdown"]

directory :: (FilePath -> Hakyll ()) -> FilePath -> Hakyll ()Source

Perform a Hakyll action on every file in a given directory.

isMoreRecentSource

Arguments

:: ClockTime

The time to check.

-> [FilePath]

Dependencies of the cached file.

-> Hakyll Bool 

Check if a timestamp is newer then a number of given files.

isFileMoreRecentSource

Arguments

:: FilePath

The cached file.

-> [FilePath]

Dependencies of the cached file.

-> Hakyll Bool 

Check if a file is newer then a number of given files.