

Embrace the Static Web with Punch - laktek
http://laktek.com/2012/11/04/embrace-the-static-web-with-punch/

======
zerostar07
This trend, hosting blogs on static html, is kind of ironic, given how popular
it is among developers. I can't make up my mind whether it's some sort of
hipsterish-nostalgic thing, a general distrust of running other people's
dynamic blog code, or just plain Occam's razor (stick to barebones).

~~~
CJefferson
For me, it's a way of avoiding having to trust / pay for someone else's
server, but also avoid worrying about keeping my wordpress install up to date.

I had a little blog I posted to every few months, and one day I found it
vandalised from my out of date wordpress.

~~~
paulgb
I think this is a huge reason for the popularity of static blogs. For dynamic
blog software, your choice is basically WordPress. Unfortunately, WordPress
has a pretty bad security track record. Things might be different if there
were a reliable second-place blogging engine, but as far as I know there
isn't.

Another reason is the rise of version control for small projects, and the way
static sites fit nicely into a Git workflow.

~~~
icebraining
I use DotClear instead of Wordpress for the blog of a local non-profit, and
it's nice, and according to them, easier to manage.

------
46Bit
As everyone has, I built my own static site generator called Fairytale
(<https://github.com/46Bit/fairytale>). Unlike a lot of them, it wasn't
intended as a simple magic-incantation tool: I reimplemented the relevant
parts of Sinatra for static-site compilation. You program everything and in
development can just use the sinatra gem instead of the fairytale one to get a
server.

I've been using it on <https://46bit.com> for something like a year now, and
the thing I've realised is that it's largely a luddite thing. The movement is
a rebellion against POS software like Wordpress, but ignores the fact that
building a nice, Markdown-driven app with caching and a lovely interface is
actually quite easy & friendlier in the long run.

It might be great for people afraid of servers, but I'm not. I don't want to
be - I'm still serving a bunch of dynamic apps off the same two servers I use
for a few static sites, and I enjoy learning how to tune them.

I'm planning to transition away from static sites. Initially to just serving a
Sinatra app, then later to a custom Padrino or Rails blog engine. Would love
to hear if anyone's got any suggestions for something off-the-shelf and hacker
friendly in Ruby though.

~~~
bmelton
I think calling it "a Luddite thing" is perhaps a little overkill.

Sure, it's easy enough to scale Wordpress, but I literally won't use 99% of
the features that Wordpress offers, and all those features are potential
attack vectors. On top of that, with every blog engine / CMS I've ever used
(including the ones I'd custom-written), at some point I end up needing to use
an iframe with static content because a CMS is only so flexible.

Instead of all that, I can put up a static page that is infinitely flexible,
use Disqus for comments, and be pretty much free of risk. No database to hack
into, no patches to apply, etc. On top of all that, it's even easier than
using Wordpress.

So, while I don't disagree that there are people using Jekyll and ilk to rebel
against Wordpress, an equally valid wonderment would be in trying to figure
out how Wordpress got so carried away.

Editing to add that your approach is pretty much the same thing I did, but in
Django instead of Ruby. I kept using the "CMS"-like methods of Django, but
then completely render them out as static pages to be published to S3.

~~~
46Bit
You sum up exactly why I've long since not cared about WordPress, but you seem
to assume anything dynamic has to have an admin interface.

The ideal engine for me still uses flat files for content, but doesn't compile
the files to HTML. Let a cache like Varnish handle the load. That way I can
implement things like comments without running off to the latest service-of-
the-month that might shut down and take everything with them.

I've spent enough time dealing with third-party javascript and issues on their
end screwing up the first-party to want no part of a remote comment service.

~~~
bmelton
So what's an example of a flat file that isn't HTML? If you have flat files,
what value does Varnish provide?

If you're accepting use input to write files, then you have vulnerability. I'm
not saying you do or don't, but it's an attack vector. As for Disqus, sure,
I'm at their whimsy when it comes to security, but they haven't bitten me yet,
and I'd hardly consider them fly-by-night as they've been around for years
now, and has been profitable since their first year.

For what it's worth, I wasn't considering the admin site as vulnerable, as
those are generally disabled before deploying, but if you're running a
database, or varnish, or Apache, or whatever, your risk is increased for
vulnerability, but I suppose that's neither here nor there really, as I think
it comes down to a matter of taste and, as you said, I'm trading system
vulnerability for third party vulnerability. The upside though is that while
sure, somebody could munge my site up, fixing it is just uploading another
copy.

~~~
46Bit
> So what's an example of a flat file that isn't HTML? If you have flat files,
> what value does Varnish provide?

Sorry, that's probably confusing language here. I was referring to structuring
Markdown files in a flat-file database, not the concept of compiled HTML
files.

------
dr_win
Here is a list of static site generators (you should add your own):
<https://gist.github.com/2254924>

I'm big fan of Jekyll. I use it intensively on my binaryage.com site:
<https://github.com/binaryage/site>

I also started working on my own client-side static-site post-processor:
<https://github.com/darwin/terraform>

This is not yet another static site generator. The idea is to have browser-
based editor for static site with live preview. Saving your changes would go
directly to github, which will trigger site regeneration.

Right now I'm waiting for PhantomJS to upgrade internal webkit version.
Terraform depends on the new DOMMutationObserver API (resp. on
<http://code.google.com/p/mutation-summary>).

~~~
bpatrianakos
Aww, I thought I was gonna be the guy who talked about my server-side static
site generator first. Haha, anyway, what I like about generating static sites
on the server, at least for my situation, is that you can hand over control to
anyone and they're immediately familiar with how it works from having used
Wordpress or some such for years.

I won't like to mine because it's still full of code written for the original
use case but mine started as a blog engine for a few of the non-technical
people in my department. They needed a blogging engine but because of some
stupid beaurocratic reason we couldn't use a database. So the options were to
add blog posts manually and fake it, teach them to use Jekyll (that would
never happen), or, what I chose, a static site generator on the server that no
one would ever think is a static site generator. They love it and think I'm a
genius (and it only consists of like 3 files which I think is funny).

------
steveax
I've gone back to static generators almost exclusively - full circle really as
some of my first web pages were generated with Userland Frontier (anyone
remember Clay Basket?) nanoc (<http://nanoc.stoneship.org/>) is currently my
tool of choice. WordPress and (popular) plugins are a huge target these days -
happy to not be worried about security with static pages. Comments can be
handled by Disqus, mobile publishing with dropbox and some plumbing. Certainly
not as easy as a "one click install" at a webhost, but fast, scalable and
infinitely configurable. Generating feeds in the build process is not
difficult either.

------
vinodkd
Previously on HN about 195 days ago :
<http://news.ycombinator.com/item?id=3877954>

But why the repost - I ask? The last time it was arunoda, who seems to be a
friend.

As somebody who'd love to post a pet project on HN sometime in the hopefully-
not-too-distant future, I sorta get that you might want people to try your
software and that maybe you'd like more eyeballs than you got the first time
around; but couldn't you be explicit about it? I'm sure that something like
"Guys, I know this has been posted before, but I'd like you look at it once
again" would be more welcome and transparent.

Update: I read through the comments on that thread. THAT was a repost. This is
the original: <https://news.ycombinator.com/item?id=3862269> (199 days,
poster: you)

Whats going on? Have you changed anything since then that you'd like to
highlight?

~~~
laktek
Yes. This was not actually a project announcement, but a tutorial published on
Appliness.

Of course, there had been lot of new features and changes to the process since
the initial release.

Also, it's up to you to decide whether to vote it to the frontpage or not.

------
gallaghersean
I still prefer LAMP. One trick to improving cache on LAMP is converting or
caching files into HTML. I know there are a number of templating engines like
Smarty out there that will do just that, but what I mean is actually
converting dynamic parts of the site that only change when an admin writes new
content. Convert those pages into static HTML files when the admin adds new
content, etc.

For example, a number of ecommerce website run off shopping cart systems that
use a database. Why not have them convert into a HTML version of the site
after the admin adds new products, edits products, ect. That would take a huge
load off the server and database.

~~~
riledhel
You can do that with nginx very easily with the Proxy module. Something like
this [http://mark.ossdl.de/2009/07/nginx-to-create-static-files-
fr...](http://mark.ossdl.de/2009/07/nginx-to-create-static-files-from-dynamic-
content/)

------
10char
Anyone have thoughts on deploying static sites to S3?

I have a few static sites and single-page JS apps, and right now I just serve
them with Nginx off a shared server. I've tried looking for a definitive
answer on "Where should I host static sites?" but it hasn't appeared yet.

~~~
laktek
Easiest option would be to use GitHub pages - <http://pages.github.com/>

But if you prefer to have more control and availability, you can use S3. Punch
makes publishing process to S3 really easy -
<https://github.com/laktek/punch/wiki/Publishing-a-Site>

------
bilalq
This seems to be the Node equivalent of Jekyll in Ruby. Pretty awesome!

------
olegp
I've written something similar in 150 lines of code, if anyone is interested:
<https://github.com/olegp/mcms>

------
zimbatm
I really like Middleman for my static websites because of the livereload
support: <http://middlemanapp.com/>

------
charliesome
The use of Mustache is a bit off putting. I'd prefer a template language that
lets me put all the gory code I like in my templates.

~~~
laktek
You have the option of changing the template engine to any one you prefer -
[https://github.com/laktek/punch/wiki/Adding-a-New-
Template-E...](https://github.com/laktek/punch/wiki/Adding-a-New-Template-
Engine)

For example, here's a handlebars plugin for Punch -
<https://github.com/laktek/handlebars>

