API

STATICL

Functions

function
&KEY (ROOT-DIR \*DEFAULT-PATHNAME-DEFAULTS\*) (STAGE-DIR (MERGE-PATHNAMES (MAKE-PATHNAME :DIRECTORY '(:RELATIVE "stage")) (UIOP/PATHNAME:ENSURE-DIRECTORY-PATHNAME ROOT-DIR))) (ALTER-PIPELINE #'IDENTITY)
function
path title url &key (description "")

Creates a new site skeleton with a few posts.

function
&KEY (ROOT-DIR \*DEFAULT-PATHNAME-DEFAULTS\*) (STAGE-DIR (MERGE-PATHNAMES (MAKE-PATHNAME :DIRECTORY '(:RELATIVE "stage")) (UIOP/PATHNAME:ENSURE-DIRECTORY-PATHNAME ROOT-DIR))) (IN-THREAD T) PORT (INTERFACE "localhost")

STATICL/BUILDER

Functions

function
&KEY (ROOT-DIR \*DEFAULT-PATHNAME-DEFAULTS\*) (STAGE-DIR (MERGE-PATHNAMES (MAKE-PATHNAME :DIRECTORY '(:RELATIVE "stage")) (UIOP/PATHNAME:ENSURE-DIRECTORY-PATHNAME ROOT-DIR))) (ALTER-PIPELINE #'IDENTITY)

STATICL/CLEAN-URLS

Generics

Converts the pathname to the form that should be used to write content to the disk.

If the site has the clean-urls setting enabled, then the filename like some/page.html will be converted to some/page/index.html. If clean-urls is not enabled, the pathname will remain unchanged.

Converts the URL to the form that should be used on the site.

If the site has the clean-urls setting enabled, then the URL like /some/page.html will be converted to /some/page/. If clean-urls is not enabled, the URL will remain unchanged.

STATICL/CONTENT

Classes

CONTENT-FROM-FILE

Readers

Absolute pathname to the file read from disk or NIL for content objects which have no source file, like RSS feeds.

CONTENT-TYPE

Readers

CONTENT-WITH-TAGS-MIXIN

Readers

CONTENT-WITH-TITLE-MIXIN

Readers

CONTENT

Readers

reader
(= (make-hash-table :test 'equal))

A hash with additional fields specified in the file's header.

Generics

Should return an absolute pathname to a file where this content item should be rendered.

Returns T if content has a given TAG-NAME. For content which does not support tags, returns NIL.

Returns a list of content objects corresponding to a given content type.

EXCLUDE argument is a list of pathname prefixes to ignore. Pathnames should be given relative to the root dir of the site.

Returns a list of content objects loaded from files.

EXCLUDE argument is a list of pathname prefixes to ignore. Pathnames should be given relative to the root dir of the site.

Writes CONTENT object to the STAGE-DIR.

Writes CONTENT object to the STREAM using given FORMAT.

Functions

function
content key value &key override-slot

Changes metadata dictionary by adding a new item with key KEY.

Key should be a string and it is automatically downcased.

Note, this way, you can override content's object slots. To prevent accidential override, function will raise an error in case if a slot named KEY exists in the object CONTENT. To force override provide OVERRIDE-SLOT argument.

STATICL/CONTENT-PIPELINE

Classes

LOAD-CONTENT

Readers

Functions

Reads content from the disk.

By default only post and page files are loaded. But this list could be extended if you'll define a custom site class and a method for staticl/content:supported-content-types generic-function.

STATICL/CONTENT/HTML-CONTENT

Generics

Returns a content as HTML string.

Returns an excerpt of full content as HTML string.

Returns T if there is more content than was returned by content-html-excerpt generic-function.

STATICL/CONTENT/PAGE

Classes

PAGE-TYPE

PAGE

STATICL/CONTENT/POST

Classes

POST-TYPE

POST

This is the class for a page which will not be included into the feed and indices.

Functions

Returns T if given object is a content of post class.

STATICL/CONTENT/READER

Functions

function
file &key (separator \*default-metadata-separator\*)

Returns a plist of metadata from FILE with :TEXT holding the content going after the SEPARATOR.

STATICL/CURRENT-ROOT

Functions

Macros

STATICL/FEEDS/ATOM

Classes

ATOM

Functions

function
&KEY (TARGET-PATH #P"atom.xml") (LIMIT 10)

Creates an XML feed in Atom format at TARGET-PATH.

Only a LIMIT latest posts are included into the feed.

STATICL/FEEDS/RSS

Classes

RSS

Functions

function
&KEY (TARGET-PATH #P"rss.xml") (LIMIT 10)

Creates an XML feed in Rss format at TARGET-PATH.

Only a LIMIT latest posts are included into the feed.

STATICL/FILTER

Classes

FILTER

Readers

Macros

macro
(&key path tags invert) &body pipeline

Filters input content objects and processes them using pipeline items given as a body.

Arguments:

  • PATH: result will contain only items read from the given path.

  • TAGS: result will contain only items having all given tags.

  • INVERT: inverts effect of the filter.

  • PIPELINE: any number of function calls returning pipeline nodes.

Note: Right now, all new items generated by PIPELINE given to the filter macro are added to the toplevel list and stay invisible to the sebsequent pipeline nodes. The same applicable to content deletion.

STATICL/FORMAT

Generics

STATICL/INDEX/BASE

Classes

BASE-INDEX

Readers

Relative pathname to a directory where all pages will be generated.

INDEX-PAGE

Readers

Relative pathname to a file with page content.

A title of the page.

Accessors

STATICL/INDEX/PAGINATED

Classes

PAGINATED-INDEX

Readers

A callback to change page titles.

Accepts single argument - a page number and should return a pathname relative to the site's root. By default, it returns index.html for the first page and page-2.html, page-3.html for others.

If site has "clean urls" setting enabled, then additional transformation to the pathname will be applied automatically.

A callback to change page titles.

Accepts single argument - a page number and should return a string.

For example, here is how you can translate page title into a russian:

(paginated-index :target-path #P"ru/"
                 :page-title-fn (lambda (num)
                                  (fmt "Страница ~A" num)))

Functions

function
&rest initargs &key target-path page-size template page-title-fn page-filename-fn

Creates additional HTML files with post's excerpts grouped by PAGE-SIZE items.

By default index.html, page-2.html, page-3.html, etc. filenames are used, but this can be overriden by PAGE-FILENAME-FN argument.

The same way page title may be overriden by providing a function as PAGE-TITLE-FN argument.

Arguments:

PAGE-FILENAME-FN:

A callback to change page titles.

Accepts single argument - a page number and should return a pathname relative to the site's root. By default, it returns index.html for the first page and page-2.html, page-3.html for others.

If site has "clean urls" setting enabled, then additional transformation to the pathname will be applied automatically.

PAGE-TITLE-FN:

A callback to change page titles.

Accepts single argument - a page number and should return a string.

For example, here is how you can translate page title into a russian:

(paginated-index :target-path #P"ru/"
                 :page-title-fn (lambda (num)
                                  (fmt "Страница ~A" num)))

STATICL/INDEX/TAGS

Classes

TAGS-INDEX

Readers

A callback to change page titles.

Accepts single argument - a tag name and should return a pathname

By default, for tag "foo-bar" it returns foo-bar.html.

If site has "clean urls" setting enabled, then additional transformation to the pathname will be applied automatically.

A callback to change page titles.

Accepts single argument - a tag name and should return a string.

For example, here is how you can translate page title into a russian:

(tags-index :target-path #P"ru/"
            :page-title-fn (lambda (tag-name)
                             (fmt "Записи с тегом ~A" tag-name)))

Functions

function
&rest initargs &key target-path page-size template page-title-fn page-filename-fn

Creates additional HTML files with post's excerpts grouped by tag names.

By default some.html, another.html filenames are used, but this can be overriden by PAGE-FILENAME-FN argument.

The same way page title may be overriden by providing a function as PAGE-TITLE-FN argument.

Arguments:

PAGE-FILENAME-FN:

A callback to change page titles.

Accepts single argument - a tag name and should return a pathname

By default, for tag "foo-bar" it returns foo-bar.html.

If site has "clean urls" setting enabled, then additional transformation to the pathname will be applied automatically.

PAGE-TITLE-FN:

A callback to change page titles.

Accepts single argument - a tag name and should return a string.

For example, here is how you can translate page title into a russian:

(tags-index :target-path #P"ru/"
            :page-title-fn (lambda (tag-name)
                             (fmt "Записи с тегом ~A" tag-name)))

STATICL/INJECTIONS

Classes

CONTENT-WITH-INJECTIONS-MIXIN

Readers

Generics

Adds a piece of HTML to the list of pieces to be inserted to a given point when content will be rendered to a file.

STATICL/LINKS/LINK

Classes

LINK

Readers

Functions

Creates a link to the given content piece.

When such object is passed to the template, it is resolved to a page URL and title.

STATICL/LINKS/PREV-NEXT

Classes

PREV-NEXT-LINKS

Functions

Creates a links between pages.

Links are added to the content item's metadata and available in templates as content.prev.url and content.next.url variables.

STATICL/NAVIGATION

Classes

ITEM

Readers

MENU

Readers

Functions

STATICL/PIPELINE

Generics

generic-function
site pipeline-node content-items

A method for this generic function should process CONTENT-ITEMS - a list of conten items produced by a previous pipeline nodes.

During the execution, method can call produce-item or remove-item functions to add a new content or to remove some content item.

Functions

function
site &key (alter-pipeline #'identity)

STATICL/PLUGIN

Classes

PLUGIN

Functions

STATICL/PLUGINS/DISQUS

Classes

DISQUS

Readers

reader
(:SHORTNAME = (ERROR "Shortname should be given."))

Functions

Enables Disqus on the page.

To make it work, you have to register your site at Disqus and provide a short site name to the function.

STATICL/PLUGINS/MATHJAX

Classes

MATHJAX

Readers

Functions

function
&KEY FORCE (TAG-NAME "math")

Enables MathJAX on the page if it's content has tag equal to the TAG-NAME or if FORCE argument was given.

STATICL/PLUGINS/SITEMAP

Classes

SITEMAP

Functions

STATICL/RSYNC

Classes

RSYNC

Readers

Functions

STATICL/SERVER

Functions

function
&KEY (ROOT-DIR \*DEFAULT-PATHNAME-DEFAULTS\*) (STAGE-DIR (MERGE-PATHNAMES (MAKE-PATHNAME :DIRECTORY '(:RELATIVE "stage")) (UIOP/PATHNAME:ENSURE-DIRECTORY-PATHNAME ROOT-DIR))) (IN-THREAD T) PORT (INTERFACE "localhost")

STATICL/SITE

Classes

SITE

Readers

Generate some-page/index.html instead of some-page.html to make URLs look like https://my-site.com/some-page/ instead of https://my-site.com/some-page.html

Site's charset. By default it is UTF-8.

A directory pathname where .staticlrc file can be found.

Site's description.

Site's navigation.

A list of pipline nodes

A theme object for the site.

Site's title.

Functions

STATICL/SKELETON

Functions

function
path title url &key (description "")

Creates a new site skeleton with a few posts.

STATICL/TAG

Classes

TAG

Readers

STATICL/THEME

Classes

THEME

Readers

Generics

Copies static files such as CSS, JS, images into the STAGE-DIR.

Usually it is enough to define a method for list-static generic-function.

Returns a list of static files such as CSS, JS, images.

Each list item should be a list of two items where first item is an absolute pathname and second is a pathname relative to the root of the site.

generic-function
theme template-name vars stream

Renders fills template named TEMPLATE-NAME with given VARS and renders into a given STREAM.

  • NAME argument is a string.

  • VARS argument is a hash table with string keys.

Fills a hash-table given as HASH argument with variables for filling a template.

If hash is NIL, then a new hash-table should be allocated with EQUAL :TEST argument.

Returned hash-table will be used for rendering a template for an OBJECT.

STATICL/URL

Generics

generic-function
site obj &key full &allow-other-keys

Returns a full object URL. A method should return an relative URL, but if case if FULL argument was given, the full url with schema and domain will be returned.

Note a call to this method should happen in a context of the with-base-url macro, because it is always return a path from the site's root even if FULL is not given (in this case return only the path without a domain).

You may wonder: "Why does we bother to return a path without a domain?" It is much easier to service such static site locally for debugging purpose, because you don't have to setup a web server and dns resolver.

Actually you will need to use FULL argument only in a rare case when you really need and absolute URL, for example in an RSS feed.

Macros

STATICL/UTILS

Functions

function
plist &rest normalizers-plist &key &allow-other-keys

Returns a new list where each value is replaced with results of call of normalizing functions.

For example:

CL-USER> (normalize-plist '(:foo "Bar" :blah 123)
                          :foo (lambda (value)
                                 (alexandria:make-keyword (string-upcase value))))
(LIST :FOO :BAR :BLAH 123)

Macros

macro
(filename root-path &key file-type) &body body

For each file under ROOT-PATH, run BODY. If FILE-TYPE is provided, only run BODY on files that match the given extension.