Hi everyone!
I’m working on a slate feature, which uses Middleman, for which I need a Middleman extension. To start, I’m an absolute Ruby noob, so go easy on me.
Here’s what I’ve got so far code wise:
class MyFeature < Middleman::Extension
def initialize(app, options_hash={}, &block)
super
app.before_render do |body, path, locs, template_class|
# Use sitemap here
body
end
end
end
::Middleman::Extensions.register(:my_feature, MyFeature)
activate :my_feature
Inside before_render
I need to access the front matter data for the page being processed. I tried accessing sitemap
and app.sitemap
but neither works.
Thanks for your help!