News for hackers. Stuff that matters.
Re:Static Website Generators by forlorn on Monday September 19, 2016 @03:32AM (#12529607)
The main problem for me is that the absolute majority of them target blogs and if you try to adapt them for a more complicated website you gonna dive very deep inside the code or continue constant search. Now I look at hugo as it seems to be a more general-purpose tool that allows to play with structure and content types.
Re:Static Website Generators by speleding on Monday September 19, 2016 @02:42PM (#12533668)
If you want something that can do complex sites take a look at http://nanoc.ws: we created a very large multi-domain site using it, in 9 languages. Our tool chain includes linters, spell checkers, multi stage deploy scripts, and capybara tests for the Javascript parts. Admittedly we've heavily customised nanoc with rake tasks and ruby scripts, but it lends itself well for that.
Re:Static Website Generators by lsaferite on Monday September 19, 2016 @08:41AM (#12530920)
Personally, the biggest issues is the CMS backend part of the process. I'm fine writing content for an SSG, but the marketing department is not. What I really want is a fast, open, and simple CMS BE that has a publishing workflow where the output is a static site. I've yet to fine the perfect candidate. The ones that are close are SaaS platforms and that is unfortunately unacceptable. I'm perfectly ok paying for software, at least if I get the source. If anyone has some suggestions, I'm all ears.

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.

Re:Static Website Generators by hunvreus on Monday September 19, 2016 @11:14AM (#12532033)
Funny you'd mention that. We're putting the final touches to an Open Source Jekyll CMS we've built for ourselves (called Jekyll+) that does just that; give a nicer interface for marketing folks and provide multilingual support out of the box.

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.

Re:Static Website Generators by lsaferite on Monday September 19, 2016 @12:42PM (#12532735)
Feel free to send me an email, I'll test it out.
Re:Static Website Generators by hunvreus on Tuesday September 20, 2016 @01:30PM (#12541295)
Will do.
Re:Static Website Generators by michaelmior on Monday September 19, 2016 @10:00AM (#12531484)
It doesn't support translation AFAICT, but I've been playing with DatoCMS[0] and I've been happy with it for my needs. I suppose you probably could build a translation workflow on top of their API if you were feeling ambitious.

[0] http://datocms.com/

Re:Static Website Generators by nfriedly on Monday September 19, 2016 @10:25AM (#12531676)
You might like contentful, it's a (paid) CMS UI & content API with plugins for a number of different SSGs.

https://www.contentful.com/developers/docs/tools/staticsiteg...

Re:Static Website Generators by realityking on Monday September 19, 2016 @08:58AM (#12531054)
There are a number Content-as-a-Service offerings that can be used with static site generators. (Though not usually with GitHub's built-in Jekyll support as it doesn't allow for plugins)

Examples: Contentful, Prismic.io, Built.io, CloudCMS

Full disclosure: I work for Contentful

Re:Static Website Generators by lsaferite on Monday September 19, 2016 @09:47AM (#12531396)
Yeah, I love the idea of Contentful, I just cannot use it unfortunately. If Contentful was available as a purchase option for self-hosting, then I'd be all over it. But it is exactly what I need.
Re:Static Website Generators by pjc50 on Monday September 19, 2016 @11:10AM (#12531997)
> "I'm perfectly ok paying for software, at least if I get the source."

Unusual position - source access is quite rare for commercial software, isn't it?

Re:Static Website Generators by lsaferite on Monday September 19, 2016 @12:34PM (#12532674)
That would be why I don't buy software that often, at least for things like this. There is nothing, beyond fear, that prevents a commercial software package from also providing sources.
Re:Static Website Generators by thex10 on Monday September 19, 2016 @09:28AM (#12531244)
Totally feel this pain too. A tool like prose.io can help with this a bit, but it's probably still not friendly enough for many non-tech folk.
Re:Static Website Generators by pietroalbini on Monday September 19, 2016 @08:56AM (#12531038)
Isn't https://www.getlektor.com what you're looking for?
Re:Static Website Generators by lsaferite on Monday September 19, 2016 @09:55AM (#12531454)
I think the flat-file part is a breaker for my current needs unfortunately. But, being OSS I could perhaps fix that, so I'll add it to my short-list of possible solutions.
Re:Static Website Generators by narrowrail on Monday September 19, 2016 @10:53AM (#12531858)
This very website we are on uses a flat-file structure (w/ millions of users). I'm curious why this is such a deal breaker for your current needs?
Re:Static Website Generators by lsaferite on Monday September 19, 2016 @12:39PM (#12532713)
Not sure how HN works under the hood, so I have no real comparison. I also have no real reason to say it's not compatible beyond not thinking that locking primitives for a shared filesystem are likely inadequate. But I'm always open to being proven wrong. So, care to provide some good reading explaining why a FF system is more than adequate?
Re:Static Website Generators by narrowrail on Monday September 19, 2016 @02:02PM (#12533338)
I don't know what you are trying to accomplish exactly, but it seems like you've convinced yourself that you need a more complex file storage mechanism. If you had listed any reason for this function, I might've understood. But, you didn't, so I had to ask. Here's 2 threads where this discussion has been had before:

https://news.ycombinator.com/item?id=5279440

https://news.ycombinator.com/item?id=7338923

Re:Static Website Generators by pietroalbini on Monday September 19, 2016 @11:52AM (#12532356)
Why using files is such an issue, if I can ask?
Re:Static Website Generators by raben_ on Monday September 19, 2016 @04:30AM (#12529827)
You should try Lektor (https://www.getlektor.com/). It has a flexible data structure with little assumption about the final product.
Re:Static Website Generators by StavrosK on Monday September 19, 2016 @07:04AM (#12530377)
I used lektor for http://portfolio.stavros.io/ and it was very easy to make what I wanted. I kind of assumed Jekyll and everything else would be like that too, are they not?
Re:Static Website Generators by pietroalbini on Monday September 19, 2016 @08:59AM (#12531057)
Some of the most popular static generators, such as Jekyll, are explicitly designed for blog posts.
Re:Static Website Generators by StavrosK on Monday September 19, 2016 @12:13PM (#12532510)
Ah, I didn't know that, thanks. Sounds like Lektor was a good choice for me, then.
Re:Static Website Generators by falcolas on Monday September 19, 2016 @09:50AM (#12531418)
FWIW, it's always possible to stand up a dynamic site, crawl it with `wget` in mirror mode, and get a static website as its output.

So long as your URLs are relative, it should work a treat with any CMS.

Re:Static Website Generators by andersonmvd on Monday September 19, 2016 @06:12AM (#12530185)
For more complicated sites I use Rails and a rake task to generate the html files, e.g.,

```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

```

Re:Static Website Generators by eli on Monday September 19, 2016 @06:36AM (#12530275)
The Python equivalent is something like Flask-Frozen.
Re:Static Website Generators by ZmFydA__ on Monday September 19, 2016 @03:56AM (#12529696)
I found Harp.js pretty good for a general purpose static site gen. It's basically just a nice pre-configured jade/ejs/sass/less/coffeescript/browserify package. As long as you follow the 'rules' in terms of project structure, it just works as both a server and a static renderer for the above.

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.

Re:Static Website Generators by dustingetz on Monday September 19, 2016 @08:45AM (#12530955)
This is all about to change, think of Github as a database, with a server side rendered page hooked up to it. There exist databases that work like git, and React/virtual dom does server-side rendering, so coming soon are frameworks that give you proper database apps, coded in javascript, that are CDN compatible. I've actually built this already but we haven't launched it publicly yet. If interested, you can give us your email at http://www.hypercrud.com
Re:Static Website Generators by the_other on Monday September 19, 2016 @10:04AM (#12531510)
Assemble.io served me well for a number of projects, commercial and private. https://github.com/assemble/assemble/

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.

Re:Static Website Generators by im_dario on Monday September 19, 2016 @06:22AM (#12530218)
Shameless plug: I created Zas [0] as a non-opinionated alternative to Hugo and Jekyll. It assumes nothing about your site.

[0] https://github.com/imdario/zas

Re:Static Website Generators by Kenji on Monday September 19, 2016 @10:44AM (#12531798)
Not wanting to dive deep inside the code but make a complicated website is like saying "I want to modify the engine of my car but I don't want to look under the hood a single time"

Well, I guess that works if you have a VW Beetle ;)

Re:Static Website Generators by danneu on Monday September 19, 2016 @11:12AM (#12532018)
Well, hopefully an SSG is saving you time compared to just writing a quick crawler that saves each route of your local Express app into a deployable static folder.

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.