View Source PhoenixPages behaviour (phoenix_pages v0.1.1)
Blogs, docs, and static pages in Phoenix. Check out the README to get started.
options
Options
:otp_app
- The name of the OTP application to use as the base directory when looking for page files. This value is required.:render_options
- Allows the renderers to be configured. Seepages/4
for the options.
Link to this section Summary
Callbacks
Gets a list of pages for a given ID. See the :id
option in pages/4
.
Same as get_pages/1
, but will raise PhoenixPages.NotFoundError
if no pages were defined with
the ID.
Functions
Finds all the pages matching a pattern and generates a GET route for each one.
Link to this section Types
@type page() :: PhoenixPages.Page.t()
Link to this section Callbacks
Gets a list of pages for a given ID. See the :id
option in pages/4
.
This can be used to get a list of pages from within a controller for index pages or further
customization such as finding related pages, filtering by a value, etc. Returns {:ok, pages}
if successful, or :error
if no pages were defined with the ID.
Same as get_pages/1
, but will raise PhoenixPages.NotFoundError
if no pages were defined with
the ID.
Link to this section Functions
Finds all the pages matching a pattern and generates a GET route for each one.
options
Options
:id
- The ID for this collection of pages so they can later be accessed withget_pages/1
andget_pages!/1
. This is only required if using those functions.:from
- The wildcard pattern used to look for pages on the filesystem. Make sure the base directory is included in your release (priv
is included by default). Defaults topriv/pages/**/*.md
.:sort
- The order of the pages returned when usingget_pages/1
andget_pages!/1
. Defined as a tuple with the first element being an atom for the sort value (which can be any value from the attributes), and the second element being either:asc
or:desc
.:attrs
- A list of attributes used when parsing the markdown frontmatter for each page. Atoms will be required for each page, key values will be optional with a default value. Defaults to[]
.:render_options
- Allows the renderers to be configured. This can also be set globally in the module options.:markdown
- Allows the Earmark renderer to be configured.:hard_breaks
- Whether to convert hard line breaks to<br>
tags. Defaults tofalse
.:wiki_links
- Whether to enable wiki-style links such as[[page]]
. Defaults totrue
.:pure_links
- Whether to convert raw URLs to<a>
tags. Defaults totrue
.:sub_sup
- Whether to convert~x~
and^x^
to<sub>
and<sup>
tags. Defaults totrue
.:footnotes
- Whether to enable footnotes. Defaults totrue
.:smartypants
- Whether to enable smartypants. Defaults totrue
.:compact_output
- Whether to avoid indentation and minimize whitespace in output. Defaults tofalse
.:escape_html
- Whether to allow raw HTML in markdown. Defaults tofalse
.:syntax_highlighting
- Whether to enable Makeup syntax highlighting. Defaults totrue
.:code_class_prefix
- A class prefix to add to the language class of code blocks.
All other options are passed to
Phoenix.Router.match/5