Edit: Just to add, I have multiple needs here that aren't enumerated, one of which is full translation support for the source content to support multi-linguale/multi-locale sites.
Preview of my local copy we're prepping up for a release end of the week: http://i.imgur.com/1VyxGzqr.png
Happy to have you testing it out and give me feedback.
https://www.contentful.com/developers/docs/tools/staticsiteg...
Examples: Contentful, Prismic.io, Built.io, CloudCMS
Full disclosure: I work for Contentful
Unusual position - source access is quite rare for commercial software, isn't it?
So long as your URLs are relative, it should work a treat with any CMS.
```ruby
namespace :app do
desc "Generate static pages"
task static: :environment do
pages = {
'/' => 'index.html'
}
app = ActionDispatch::Integration::Session.new(Rails.application)
pages.each do |route, output|
puts "Generating #{output}..."
outpath = File.join ([Rails.root, 'public', output])
resp = app.get(route)
if resp == 200
File.delete(outpath) if File.exists?(outpath)
if app.response.body.empty?
puts "[ no content ]"
else
encoded_body = app.response.body.encode(
'UTF-8',
{:invalid => :replace, :undef => :replace, :replace => '?'}
)
File.open(outpath, 'w') do |f|
f.write(encoded_body)
end
end
else
puts "Error generating #{output}!"
end
end
end
end```
It can be as complex or simple as you like - you could use it for a blog even, you'd just need to write some of the logic yourself in your templates.
I have used it personally for simple 2-3 page sites, where all I want to do is use some simple templates, compile some sass and bundle my scripts, without having to faff with config and build pipelines.
I've not touched it in about 20 months, but when I was using it more often, I found the documentation a bit weak. Everything you'll need is there, but possibly not written in the way you'd hope.
Well, I guess that works if you have a VW Beetle ;)
If you find yourself credentializing in the source of an SSG because it turns out you're doing something it doesn't support, then there's a point where it might've been faster to build as a dynamic site (more general tooling) with a static site build step.
It's an easy place to find yourself since so many SSGs generalize around blogging.