View Source Tableau.PageExtension (tableau v0.19.0)

Content files (with YAML frontmatter) in the configured pages directory will be automatically compiled into Tableau pages.

Certain frontmatter keys are required and all keys are passed as options to the Tableau.Page.

Options

Frontmatter is compiled with yaml_elixir and all keys are converted to atoms.

  • :title - The title of the page
  • :permalink - The permalink of the page.
  • :layout - A string representation of a Tableau layout module.
  • :converter - A string representation of a converter module. (optional)

Example

id: "GettingStarted"
title: "Getting Started"
permalink: "/docs/:title"
layout: "ElixirTools.PageLayout"
converter: "MyConverter"

The permalink is a string with colon prefixed template variables.

These variables will be swapped with the corresponding YAML Frontmatter key, with the result being piped through to_string/1.

Configuration

  • :enabled - boolean - Extension is active or not.
  • :dir - string - Directory to scan for markdown files. Defaults to _pages
  • :permalink - string - Default output path for pages. Accepts :title as a replacement keyword, replaced with the page's provided title. If a page has a :permalink provided, that will override this value for that page.
  • :layout - string - Elixir module providing page layout for pages. Default is nil.

Example

config :tableau, Tableau.PageExtension,
  enabled: true,
  dir: "_docs",
  permalink: "/docs/:title",
  layout: "MyApp.PageLayout"

Content formats

If you're interested in authoring your content in something other than markdown (or you want to use a different markdown parser), you can configure a converter for your format in the global configuration.

Currently the Tableau.MDExConverter is the only builtin converter, but you are free to write your own!

# configs/config.exs
config :tableau, :config,
  converters: [
    md: Tableau.MDExConverter,
    adoc: MySite.AsciiDocConverter
  ],

As noted above, a converter can be overridden on a specific page, using the frontmatter :converter key.

Summary

Functions

Callback implementation for Tableau.Extension.config/1.

Callback implementation for Tableau.Extension.run/1.

Functions

Callback implementation for Tableau.Extension.config/1.

Callback implementation for Tableau.Extension.run/1.