Live data from Hacker News

Static Website Generators Are the Next Big Thing

smashingmagazine.com

141–150 of 187 posts

Re: Static Website Generators Are the Next Big Thing

#142

The reason I like static site generators so much is because it allows me to treat my website as a program that outputs a website. Take some posts in whichever format you prefer, write a program to parse them as a tree of HTML nodes, insert them into templates for HTML pages, Atom feeds, etc. It's all just plain text code and markup, no stateful database with a dynamic web application in front doing everything.

The downside to static site generators is that you are constantly recreating the entire site, even for pages that won't change (which is most of them, most of the time) every time you run it. It's a function of:

   template(data) -> html
I'm a fan of the inverse of this. The template and the output (html) are the same thing; I don't separate them. Instead I just update the html when something changes. The function is:

  update(html, data)
Where update is a function you write that modifies the html in place.

The upside to this is that generating new content is cheap, you only ever update the things that need updating.

The downside is that your html output and updating function are tightly coupled; you can't change the structure of your html without also changing your update function.

I think that's ok though. Changing templates are infrequent enough to warrant the increased cost of fixing everything when you do change them.

Re: Static Website Generators Are the Next Big Thing

#143

I use MiddleMan as a static site generator for a page hosted on my raspberry pi: http://pi.tafkas.net As I am more of a python guy I wonder if there is a similar (as in not primarily for blogging) generator for python?

Have you tried Pelican? Staticgen.com lists all of them, and it tells you what language each one uses.

Re: Static Website Generators Are the Next Big Thing

#144
post #139

I agree with the article and think static web sites is the way to go if the read/write ratio is high, and where the view is not unique to the user. However, quote > "The static version is more than six times as fast on average!" This must be an engineering problem, especially on easily cached content. Serving static web sites Does require computation. But the current tools are very well made and optimized for it, wit…

I've done lots of these kinda performance tests against all kind of dynamic sites, and higher end managed hosting services like WPEngine, etc...

Once in a while someone manage to get CDN hosting just right, but it's really rare, and it's not something you can simply automate with a dynamic site (like we can for static sites with netlify). Typically the result is identical to the Smashing Magazine Site, often a lot worse. Smashing does a good job of caching at their origin datacenter, but their HTML doesn't get cached at edge nodes. Many other sites does a far worse job of caching at their origin.

It might be true that to some degree it's an engineering issue, but if it's one that hits 95%+ of all sites built with a dynamic approach and can be completely eliminated with a static approach, then obviously it might be better to shift the balance and default to doing thing statically instead of reaching for Wordpress/Rails/Drupal/whatever for each new site...

Re: Static Website Generators Are the Next Big Thing

#145
post #135

When I was heading up reliability at Netflix, we considered, and even began evaluating, turing the whole thing into one big static site. Each user had a custom listing, but generating 60+ million static sites is a very parallelizeable problem. At the time, the recommendations only updated once a day, but an active user would have to dynamically load that content repeatedly, and at the same time, the recs were getting…

I might be wrong, but I believe that 4chan does something similar to this: Every time a post is made, the board is updated and new static pages are generated. All the server does then is serve this static pages. (I can't find any official reference to this though, but another user has referenced this some time ago: https://news.ycombinator.com/item?id=8060200 )

[deleted]

Re: Static Website Generators Are the Next Big Thing

#146
People are finally starting to realize that CMSes are horrible. They got us through a time period where the front-end developer is a scare resource, but now there's enough of them everywhere that we don't need WYSIWYG web content anymore. CMSes are eventually going to be relegated to the sole proprietor who doesn't want to learn HTML but still needs to maintain his / her own content-oriented website.

My company is handcuffed to a legacy custom CMS that's still using Rails 2.3.8. We have no need for it, as we have a front-end guy who would be perfectly comfortable using git, as he has me to ask whenever there's a problem. When you use the database to store content, you lose a great number of useful properties. I had to build a custom tool to search through the entire database to find encoding errors. And I had to keep re-adjusting it every time I found some hiding somewhere. It was annoying and painful. Content is code, not data, it needs to be managed like code.

Re: Static Website Generators Are the Next Big Thing

#147
Think of web app architectures like data structures. Most websites should be optimized for reading, not writing. Static site generators are very optimized for reading, not writing. Wordpress sites, on the other hand, are more optimized for writing. It makes sense that most websites should choose static site generators - it's just a better "data structure" for the needs.

Re: Static Website Generators Are the Next Big Thing

#148
Sadly, I think it will never work for end users. I myself also don't update my blog very often, partly because writing new posts is still too cumbersome (with Jekyll). I am a developer, but I don't use Markdown and Liquid (or what was the name) on a daily basis, so I still have to look things up when writing.

Now I tend to think that the best way would be to use a random CMS (like Wordpress) and mirror it's output as a static site. That way, the dynamic part the end user uses for creating content could be behind some secure login-wall, and the public site would just be static.

As for comments, I guess they just won't be supported.

Re: Static Website Generators Are the Next Big Thing

#149
post #135

When I was heading up reliability at Netflix, we considered, and even began evaluating, turing the whole thing into one big static site. Each user had a custom listing, but generating 60+ million static sites is a very parallelizeable problem. At the time, the recommendations only updated once a day, but an active user would have to dynamically load that content repeatedly, and at the same time, the recs were getting…

I might be wrong, but I believe that 4chan does something similar to this: Every time a post is made, the board is updated and new static pages are generated. All the server does then is serve this static pages. (I can't find any official reference to this though, but another user has referenced this some time ago: https://news.ycombinator.com/item?id=8060200 )

That's also how the most popular guestbooks and forums in the 90s worked. e.g., WWWBoard, which seemed to be used almost everywhere for quite a while. A perl script would generate a new HTML file and update the index HTML for each post.

Re: Static Website Generators Are the Next Big Thing

#150
post #124

It's an interesting idea, and I see the appeal if the site is fairly basic, but I think there's one thing people are forgetting here. You're outsourcing half your site to third parties, and basically letting them do whatever the hell they like with it. Disqus comments? Better hope the people behind that system don't decide to outlaw comments about the thing your website is about. Javascript embedded shop system? Good…

Personally, I generally trust a third-party's shop system significantly more than I do something homegrown for a typical small business. Credit card security is hard. Why force everyone to reinvent the wheel?
Post reply on HN