Live data from Hacker News

Static Website Generators

netlify.com

111–120 of 241 posts

Re: Static Website Generators

#111
post #37

Are there any real differentiating factors or are there so many because they're so easy to do? I built a custom one for a client once for no real reason.

Cross-platform support and dependencies would be one: hugo shines for me because every modern *ix, OS X, and Windows are all first-class golang environments, so it Just Works anywhere, and you don't spend years waiting for a package manager to churn through a dependency tree to install or update.

Ruby or node? Not so much.

Also, depending on who you are, how many out-of-the-box themes, and how sane/easy it is to create or customise.

Re: Static Website Generators

#112
post #21
post #12

I use Hugo for several websites and I enjoy it a lot. One favorite part is the ability to create content of different types.

This statement caught my attention in the article: > It is optimized for speed (Hugo sites can be built in milliseconds) Is that true, or does it just happen to be fast? It seems to me that the performance of a static site generation is irrelevant, and thus time spent on this is really wasted effort. I don't care if it takes several minutes to build.. it'll happen on the CI server in the background, and so long as th…

> It seems to me that the performance of a static site generation is irrelevant, and thus time spent on this is really wasted effort.

Another consideration is pages which take a long time to render. When I'm writing about code (which is a lot!) I use a literate programming style, so that code snippets on a page can be executed and have their output embedded in the HTML. This ensures that the code I'm discussing actually works as claimed, and keeps everything self-contained; but it can make rendering arbitrarily slow!

At the moment, the longest wait is a few minutes for the graphs on http://chriswarbo.net/blog/2014-07-23-fib.html and the images on http://chriswarbo.net/projects/procedural/cantor.html

As long as the build system is incremental (I use GNU Make) the cost only has to be paid when changing those pages (either their content, or a template), so it doesn't slow down the edit/build cycle for other pages.

Re: Static Website Generators

#113
post #108

What about using whatever engine you want, then extract static pages with a script using good ol' wget -r ?

I sort-of-but-not-quite did this when migrating my old dynamic site to static generation: I used my model API to build a list of all the pages and then faked requests by building my own request objects that I called my Sinatra app with.

Made for a quick and dirty way of reusing my old code, and means I can still run the dynamic version for dev/testing.

Re: Static Website Generators

#115
Why is that website only using the middle of the page, and has a blank line between every line of text.

Is there some competition for who can use as little of my screen as possible in a useful way?

Re: Static Website Generators

#116
post #93

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.

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

#117
post #93

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.

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

#118
post #115

Why is that website only using the middle of the page, and has a blank line between every line of text. Is there some competition for who can use as little of my screen as possible in a useful way?

It's to increase readability. An ideal column width can help users to scan through the paragraph effortlessly.

http://ux.stackexchange.com/questions/3618/ideal-column-widt...

Re: Static Website Generators

#119
post #93

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.

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 == 20…

The Python equivalent is something like Flask-Frozen.

Re: Static Website Generators

#120
The main question for me is comments. I don't want to use something like Disqus, and to require something like Discourse would cancel the whole point of having a static site generator that I can host on Github Pages or Gitlab pages. Ideally, what I would like to do is to have an hackernews post automatically generated for each post, and to redirect people to the HN post if they want to comment, but I am not sure that HN allow this kind of use ?
Post reply on HN