GriffinSSG (Griffin v0.4.2)

View Source

Griffin is a Static Site Generator.

Griffin reads Markdown files from disk and outputs HTML pages. A combination of Application level config, frontmatter attributes and layout files can be used to customize the output of each file and to build the page structure of the website.

Each input file can have a first segment called "front matter" that lists metadata about the file contents. This front matter segment is delineated by a sequence of characters --- and the contents should be in YAML format. The contents that follow can contain plain content or reference front matter attributes. Here is an example of a short Markdown file with some front matter attributes:

---
title: "Griffin Static Site Generator"
draft: true
---

# Griffin Static Site Generator
Griffin is an Elixir framework for building static websites.

Summary

Functions

Lists all pages in a directory, returning metadata about each page. The directory page is relative to the project root.

Parses a file at the given path into two components: front matter and file content.

Parses the string contents of a file into two components: front matter and file content.

Renders a layout with a given content, front matter and assigns.

Functions

list_pages(parsed_files, directory, opts \\ [])

Lists all pages in a directory, returning metadata about each page. The directory page is relative to the project root.

parse(file_path, input_path, output_path)

Parses a file at the given path into two components: front matter and file content.

parse_string(string_content)

Parses the string contents of a file into two components: front matter and file content.

Front matter is an optional YAML snippet containing variables to be used in the content. The content immediately follows the front matter and may reference front matter variables.

Returns {:ok, map()} where map contains both the front matter and file content.

render(layout, options)

Renders a layout with a given content, front matter and assigns.

The layout is assumed to be a compiled EEx file or string, such that calling Code.eval_quoted/2 on the layout will generate a correct result.