Created
February 2, 2013 22:49
-
-
Save tdreyno/4699599 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Store somewhere | |
class SitemapGenerator | |
def initialize(app) | |
@app = app | |
end | |
def manipulate_resource_list(resources) | |
sitemap_builder = ::Middleman::Sitemap::Resource.new( | |
@app.sitemap, | |
"sitemap.xml", # The URL | |
File.join(File.dirname(__FILE__), 'source', 'sitemap.xml.builder') # Path to your template | |
) | |
resources << sitemap_builder | |
resources | |
end | |
end | |
# In your extension register/setup method | |
app.after_configuration do | |
sitemap.register_resource_list_manipulator(:sitemap_generator, | |
SitemapGenerator.new(self), | |
false) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey Thomas -
I've tried adding this to an example extension I made. However, when I run
middleman build --verbose
, It appears an additional path to the template is being prefixed onto my specified path:Here's the code causing this:
So the correct path is getting prefixed with
/home/dave/middleman-test/source/
. Can you see what I'm doing wrong? I've updated my repo so you can reproduce this on your machine, if you want. Thanks again for the help :) .