As of this post, this blog is now hosted by GitHub’s recently announced GitHub Pages, still Webby powered, now with extra git goodness.

GitHub Pages generates a static site from a GitHub hosted repo, using Jekyll to generate the files. Jekyll understands two special directories _posts and _layouts, copying any other files and directories in the root of the repo that do not begin with an _ directly to the static site.

Webby generates a static site from set of source files (content, layouts, etc), placing the results in the output_dir (defaults to output but can be changed.)

To make Webby and GitHub Pages co-exist, I restructured my repo and made the following changes to my existing Webby site:

1SITE.output_dir = '..'
2
3task :default => :clean_build
 1# From http://www.taknado.com/2007/7/30/overriding-rake-tasks
 2Rake::TaskManager.class_eval do
 3  def remove_task(task_name)
 4    @tasks.delete(task_name.to_s)
 5  end
 6end
 7
 8def remove_task(task_name)
 9  Rake.application.remove_task(task_name)
10end
11
12def override_task(args, &block)
13  name, deps = Rake.application.resolve_args([args])  
14  remove_task Rake.application[name].name
15  task(args, &block)
16end
 1# We only want to remove the generated files
 2desc "Delete the website"
 3override_task :clobber do |t|
 4  Dir.chdir(Webby.site.output_dir) do
 5    Dir['*'].entries.reject {|entry| entry == '_webby'}.each {|entry| rm_rf entry}
 6  end
 7end
 8
 9desc "Clobber, then build the website"
10task :clean_build => [:clobber, :build]

The new workflow for adding a post to the new site is:

  1. Change directory to _webby
  2. Generate a new blog post
  3. Run webby autobuild
  4. Edit until completed
  5. Commit all changes locally (git add . from the root)
  6. Push the changes

1 Webby does not know if you have deleted a source file, by forcing the entire site to be rebuilt, the deletion is reflected in the generated static files.

blog comments powered by Disqus