« ReFreezed.com


These are global objects.


These values can be configured in config.lua.


site.baseUrl = url

The base part of the website's URL, e.g. "http://www.example.com/" or "https://example.com/subdir/". This value is required for every site!


site.defaultLayout = layoutName

The default layout pages will use. Setting this to an empty string will make pages use no layout by default. Default: "page" (which corresponds to the file layouts/page.html)

Some example values and what file they refer to:

  • "no-title" (layouts/no-title.html)
  • "themes/new/pretty" (layouts/themes/new/pretty.html)


site.description = description

A description for the website. Default: ""


site.languageCode = languageCode

The code for the language of the website, e.g. "dk". (This doesn't do much yet, but will be used for i18n in the future.) Default: ""


site.title = title

The title of the website. Default: ""


Note that all fields become read-only after the page content has been generated (or after lock has been called).


page.aliases = urls

A list of URLs that point to previous locations of the page. This serves the same purpose as config.redirections. Example:

-- Current file: a-better-omelet.md
page.title   = "Making a Better Omelet"
page.aliases = {"/how-to-make-omelet/", "/omelet-tutorial/"}


page.content = htmlCode

readonly The HTML content of the page. Available in layouts (and later). Trying to access the content before it has finished generating or in an invalid situation will raise an error. Example:

<!-- layouts/page.html -->
		<title>{{ page.title }}</title>
		{{ page.content }}


page.date = datetime

What date the page was created. Default: file modification time, or epoch time

Even though the default value is the time the file was last modified (if that information is accessible by the program) it's still recommended that every page update this to an explicit value (otherwise the date may end up being 1970-01-01).

See datetime for the date format.

Note: Every page generated with generateFromTemplate should update this value because there's no source file to grab the modified time from.


page.dateModified = datetime

v1.3 What date the page was last modified. If this isn't set then the value of page.date is used. See datetime for the date format. Default: ""


page.description = description

A description for the page. Default: ""


page.isDraft = bool

If the page is a draft. Drafts are excluded from the website build (unless the --drafts option is used). Default: false


page.isHome = bool

readonly If the page is the root index page, aka the homepage.


page.isIndex = bool

readonly If the page is an index page.


page.isPage = bool

readonly If the page is in fact a page. This value is true for HTML/Markdown files, and false for CSS files for example.


page.isSpecial = bool

If the page is some kind of special page. Special pages are ignored by subpages. Set this to true for e.g. 404 error pages. Default: usually false, but sometimes true (e.g. for redirection pages)


page.layout = layoutName

What layout the page should use. Setting this to an empty string will make the page not use any layout. Default: site.defaultLayout


page.params = table

readonly Table for storing any custom data you want. Also see the params/P aliases. Note that while the table itself cannot be swapped out, fields of the table can be updated freely.

page.permalink = url

readonly The permanent URL for the page. This URL is absolute.


page.publishDate = datetime

What date the page was, or is going to be, published. If the date is in the future (or past the date specified by the --date option) then the page is excluded from the website build. If this isn't set then the value of page.date is used. See datetime for the date format. Default: ""


page.redirectionTarget = url

readonly On redirection pages, this value is set to the redirection target URL. Otherwise, it's empty.


page.title = url

The title of the page. Every page should update this value. Default: ""


page.url = url

readonly The relative URL to the page on the site.

Note: If site.baseUrl has a path containing a subdirectory then this URL is relative to that directory and not to the host name. For example, if site.baseUrl is "http://example.com/abc/" then page.url for the file content/foo.md will be "/foo/" and page.permalink will be "http://example.com/abc/foo/". Or, in other words, page.url for a file will always be the same no matter what site.baseUrl is. Use url to safely link to a page using page.url.

Other Objects


Access data from the data folder. Type e.g. data.cats to retrieve the contents of data/cats.lua or data/cats.toml. Files can be in subfolders (e.g. type data.foo.bar to access data/foo/bar.toml). See DATA_FILE_EXTENSIONS for supported data formats.


params or P

Table for storing any custom data you want. Aliases for page.params.


v1.3 Access scripts from the scripts folder. Type e.g. scripts.foo() to call the function returned by of scripts/foo.lua. Files can be in subfolders (e.g. type scripts.abc.xyz to access scripts/abc/xyz.lua).

Note that scripts can be accessed with or without the prefix scripts. - this object mostly exists in case there's a name conflict between a script and one of LuaWebGen's existing globals.

Page updated: 2022-04-13