The render pipeline can be modified by including either custom or 3rd-party extensions.
The pipeline is configured using the
pipeline.rb file in the
_ext/ directory is automatically added to the
so that site-supplied extensions may easily be loaded.
An extension class only need implement a single method,
Each extension in the pipeline will be called, in-order, and passed the
class MyExtension def execute(site) # body goes here end end
New extensions can be added to the existing
require 'my_extension' Awestruct::Extensions::Pipeline.new do extension MyExtension.new extension Awestruct::Extensions::Posts.new( 'news' ) extension Awestruct::Extensions::Indexifier.new end
The extension pipeline runs immediately before the final URL assignment to pages and generating the final output pages.
Given the timing of the extension pipeline execution, advanced functionality can be applied. Pages can be added or removed, output locations can be changed, and links between pages or YAML-based structures may be created.
Since the extension pipeline runs before the final render stage, it has the opportunity to do wild manipulations to the state of the site.
Posts extension makes any Awestruct site
"blog-aware". It scans all pages under a given sub-tree, and if they match
a particular naming convention, it does some work.
If the current output path matches the pattern of
it does the following:
page.output_pathto use directories instead of dashes.
page.nextpoints to the next entry
page.previouspoints to the previous entry
Indexifier extension adjusts the
page.url for any page that is not currently output as an
For instance, a page with a
modified so that
By placing the
Indexifier last in the chain, it can affect the
entire tree, regardless of the source of the page.
An extension may decide to leave all pages alone, but inject additional synthetic pages into a site at generation time.