(add-description {:keys [blocks-per-preview description-include-elements]
:or {description-include-elements #{:h5 :h4 :h6 :h2 :h1 :h3
:p}}}
page)
Add plain text :description
to the page/post for use in meta description etc.
Add plain text `:description` to the page/post for use in meta description etc.
(add-prev-next pages)
Adds a :prev and :next key to the page/post data containing the metadata of the prev/next post/page if it exists
Adds a :prev and :next key to the page/post data containing the metadata of the prev/next post/page if it exists
(add-toc {:keys [content-dom toc toc-class] :as article} config)
Adds :toc to article, if necessary
Adds :toc to article, if necessary
(compile-archives {:keys [blog-prefix] :as params} posts)
Compiles the archives page into html and spits it out into the public folder
Compiles the archives page into html and spits it out into the public folder
(compile-assets)
(compile-assets {:keys [extend-params-fn update-article-fn]
:or {extend-params-fn (fn [params _] params)
update-article-fn (fn [article _] article)}
:as overrides-and-hooks}
changeset)
Generates all the html and copies over resources specified in the config.
Params:
overrides-and-hooks
- may contain overrides for config.edn
; anything
here will be available to the page templates, except for the following special
parameters:
:extend-params-fn
- a function (params
, site-data
) -> params
-
use it to derive/add additional params for templates:postprocess-article-html-fn
- a function (article
, params
) -> article
called after the :content
has been rendered to HTML and
right before it is written to the disk. Example fn:
(fn postprocess [article params] (update article :content selmer.parser/render params))
:update-article-fn
- a function (article
, config
) -> article
to update a
parsed page/post. Return nil to exclude it.changeset
- as supplied by
cryogen-core.watcher/start-watcher-for-changes!
to its callback
for incremental compilation, see only-changed-files-filter
for detailsNote on terminology:
article
- a post or page data (including its title, content, etc.)config
- the site-wide configuration ± from config.edn
and the provided overridesparams
- config
+ content such as :pages
etc.site-data
- a subset of the site content such as :pages
, :posts
- see the code belowGenerates all the html and copies over resources specified in the config. Params: - `overrides-and-hooks` - may contain overrides for `config.edn`; anything here will be available to the page templates, except for the following special parameters: - `:extend-params-fn` - a function (`params`, `site-data`) -> `params` - use it to derive/add additional params for templates - `:postprocess-article-html-fn` - a function (`article`, `params`) -> `article` called after the `:content` has been rendered to HTML and right before it is written to the disk. Example fn: `(fn postprocess [article params] (update article :content selmer.parser/render params))` - `:update-article-fn` - a function (`article`, `config`) -> `article` to update a parsed page/post. Return nil to exclude it. - `changeset` - as supplied by [[cryogen-core.watcher/start-watcher-for-changes!]] to its callback for incremental compilation, see [[only-changed-files-filter]] for details Note on terminology: - `article` - a post or page data (including its title, content, etc.) - `config` - the site-wide configuration ± from `config.edn` and the provided overrides - `params` - `config` + content such as `:pages` etc. - `site-data` - a subset of the site content such as `:pages`, `:posts` - see the code below
(compile-assets-timed)
(compile-assets-timed config)
(compile-assets-timed config changeset)
See the docstring for compile-assets
See the docstring for [[compile-assets]]
(compile-authors {:keys [blog-prefix author-root-uri author] :as params} posts)
For each author, creates a page with filtered posts.
For each author, creates a page with filtered posts.
(compile-index {:keys [blog-prefix debug? home-page] :as params})
Compiles the index page into html and spits it out into the public folder
Compiles the index page into html and spits it out into the public folder
(compile-pages {:keys [blog-prefix page-root-uri debug?] :as params} pages)
Compiles all the pages into html and spits them out into the public folder
Compiles all the pages into html and spits them out into the public folder
(compile-posts {:keys [blog-prefix post-root-uri debug?] :as params} posts)
Compiles all the posts into html and spits them out into the public folder
Compiles all the posts into html and spits them out into the public folder
(compile-preview-pages {:keys [blog-prefix posts-per-page blocks-per-preview]
:as params}
posts)
Compiles a series of pages containing 'previews' from each post
Compiles a series of pages containing 'previews' from each post
(compile-tags {:keys [blog-prefix tag-root-uri] :as params} posts-by-tag)
Compiles all the tag pages into html and spits them out into the public folder
Compiles all the tag pages into html and spits them out into the public folder
(content-until-more-marker content-dom)
Returns the content until the <!--more--> special comment, closing any unclosed tags. Returns nil if there's no such comment.
Returns the content until the <!--more--> special comment, closing any unclosed tags. Returns nil if there's no such comment.
(copy-resources-from-markup-folders {:keys [post-root page-root] :as config})
Copy resources from markup folders. This does not copy the markup entries.
Copy resources from markup folders. This does not copy the markup entries.
(create-preview blocks-per-preview post)
Creates a single post preview
Creates a single post preview
(create-preview-links previews params)
Turn each vector of previews into a map with :prev and :next keys that contain the uri of the prev/next preview page
Turn each vector of previews into a map with :prev and :next keys that contain the uri of the prev/next preview page
(create-previews posts posts-per-page blocks-per-preview)
Returns a sequence of vectors, each containing a set of post previews
Returns a sequence of vectors, each containing a set of post previews
(find-entries root mu ignored-files)
Returns a list of files under the content directory according to the implemented Markup protocol and specified root directory. It defaults to looking under the implemented protocol's subdirectory, but fallsback to look at the content directory.
Returns a list of files under the content directory according to the implemented Markup protocol and specified root directory. It defaults to looking under the implemented protocol's subdirectory, but fallsback to look at the content directory.
(find-pages {:keys [page-root ignored-files]} mu)
Returns a list of markdown files representing pages under the page root.
Returns a list of markdown files representing pages under the page root.
(find-posts {:keys [post-root ignored-files]} mu)
Returns a list of markdown files representing posts under the post root.
Returns a list of markdown files representing posts under the post root.
(group-by-tags posts)
Maps all the tags with a list of posts that contain each tag
Maps all the tags with a list of posts that contain each tag
(group-for-archive posts)
Groups the posts by month and year for archive sorting
Groups the posts by month and year for archive sorting
(group-for-author posts default-author)
Groups the posts by author. If no post author if found defaults default-author
.
Groups the posts by author. If no post author if found defaults `default-author`.
(group-pages pages)
Separates the pages into links for the navbar and links for the sidebar
Separates the pages into links for the navbar and links for the sidebar
(merge-meta-and-content file-name page-meta content-dom)
Merges the page metadata and content maps
Merges the page metadata and content maps
(only-changed-files-filter changeset)
Returns a page/post filter that only accepts these files:
changeset
is empty (as it means this is the first build)Arguments:
changeset
- sequence of java.io.File
of relative paths within the
project, such as File[content/asc/pages/about.asc]
, as provided by
cryogen-core.watcher/find-changes
Downsides: Tags, archives, index etc. will only know about the recompiled post and not the others. Previous/next links on neighbour posts won't be updated either.
Returns a page/post filter that only accepts these files: - no filtering if `changeset` is empty (as it means this is the first build) - recompile the post/page that has changed since the last compilation - recompile everything if a template HTML file has changed Arguments: - `changeset` - sequence of `java.io.File` of relative paths within the project, such as `File[content/asc/pages/about.asc]`, as provided by [[cryogen-core.watcher/find-changes]] Downsides: Tags, archives, index etc. will only know about the recompiled post and not the others. Previous/next links on neighbour posts won't be updated either.
(page-content page config markup)
Returns a map with the given page's file-name, metadata and content parsed from the file with the given markup.
Returns a map with the given page's file-name, metadata and content parsed from the file with the given markup.
(page-uri file-name params)
(page-uri file-name uri-type {:keys [blog-prefix clean-urls] :as params})
Creates a URI from file name. uri-type
is any of the uri types specified in config, e.g., :post-root-uri
.
Creates a URI from file name. `uri-type` is any of the uri types specified in config, e.g., `:post-root-uri`.
(parse-page page config markup)
Parses a page/post and returns a map of the content, uri, date etc.
Parses a page/post and returns a map of the content, uri, date etc.
(parse-post page config markup)
Return a map with the given post's information.
Return a map with the given post's information.
(parse-post-date file-name date-fmt)
Parses the post date from the post's file name and returns the corresponding java date object
Parses the post date from the post's file name and returns the corresponding java date object
(re-pattern-from-exts exts)
Creates a properly quoted regex pattern for the given file extensions
Creates a properly quoted regex pattern for the given file extensions
(read-page-meta page rdr)
Returns the clojure map from the top of a markdown page/post
Returns the clojure map from the top of a markdown page/post
(read-pages config incremental-compile-filter)
Returns a sequence of maps representing the data from markdown files of pages. Sorts the sequence by post date.
Returns a sequence of maps representing the data from markdown files of pages. Sorts the sequence by post date.
(read-posts config incremental-compile-filter)
Returns a sequence of maps representing the data from markdown files of posts. Sorts the sequence by post date.
Returns a sequence of maps representing the data from markdown files of posts. Sorts the sequence by post date.
(render-file file-path params)
Wrapper around selmer.parser/render-file
with pre-processing
Wrapper around `selmer.parser/render-file` with pre-processing
(tag-info config tag)
Returns a map containing the name and uri of the specified tag
Returns a map containing the name and uri of the specified tag
(tag-post tags post)
Adds the uri and title of a post to the list of posts under each of its tags
Adds the uri and title of a post to the list of posts under each of its tags
(tag-posts posts config)
Converts the tags in each post into links
Converts the tags in each post into links
(url-encode str)
Url encode path element. Encodes spaces as %20 instead of +, because some webservers pass + through to the file system
Url encode path element. Encodes spaces as %20 instead of +, because some webservers pass + through to the file system
(write-html file-uri {:keys [blog-prefix clean-urls]} data)
When clean-urls
is set to:
:trailing-slash
appends /index.html
.:no-trailing-slash
appends .html
.:dirty
just spits.When `clean-urls` is set to: - `:trailing-slash` appends `/index.html`. - `:no-trailing-slash` appends `.html`. - `:dirty` just spits.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close