
Show HN: Super simple static blog generator, Benjen - daeken
http://daeken.com/2013-03-17_Benjen_v1.html
======
StavrosK
And, to complement this, I wrote a small program that serves static (or
Jinja2) files from folders (optionally on AppEngine):

[https://github.com/stochastic-technologies/static-
appengine-...](https://github.com/stochastic-technologies/static-appengine-
hoster)

You just create a folder called "yourdomain.com" and put your static files in
there, upload, done. All URLs are rewritten (/foo/bar/ resolves to
/foo/bar.html or /foo/bar/index.html) and you can host multiple domains on the
same GAE instance. I use it for various static sites, such as my company's
site (<http://www.stochastictechnologies.com/>) and my resume
(<http://resume.korokithakis.net/>). They're all pretty much hosted for free,
since they're static files on a single app on AppEngine, and migration is
almost free (you just upload the whole thing to the host of your choice).

You can also assign multiple domains to one site, or rewrite your URLs to
custom files.

~~~
positr0n
What is the benefit of your server over just dumping the static files to S3
and letting Amazon serve them?

~~~
StavrosK
Does S3 remove the .html extension from URLs? I can't stand dirty URLs.

------
progrock
I think the main itch being scratched here, is the problem of templating.

Those that grok file systems, might be happy assembling content into an
appropriate folder structure, and hitting a 'publish (to html)' button. You
could use a little metadata - such as summaries and keywords to string it all
together.

I know there are systems such as Pelican already out there, but it's still too
complicated for Joe Blow to produce a site with the tool.

Frames were a pretty simple alternative to elaborate CMS's that have been
employed to pretty much solve the same problem.

So much wasted CPU time and money. So called professionals cashing in while
presenting building web sites as mystical and technically difficult (I realise
the tech is difficult - but why should it be?). It goes so against Tim
Berners-Lee's vision of publishing easily and straight from the browser.

Not having some dead simple web page editor, has ended in sites such as
Facebook becoming 'the web' to so many people.

~~~
daigoba66
I miss Geocities, etc.

~~~
krapp
Tripod is still around, but I haven't actually tried to use it in ages. Shame
about geocities though.

------
chewxy
I have been seeing a lot of static blog generators being paraded around
lately. I seriously think that static blog generators should be the next
"hello world" when learning a new language. It seems to be useful in doing
just that.

~~~
qznc
The intention of Hello-World is to check that compiler-linker and basic IO
works.

A static blog generator checks that filesystem access works and your language
provides a markdown and a template library.

~~~
chewxy
Oh I mean it as a way to know how the language works.

EDIT for more information:

Being able to write a static blog generator means you have to learn most of
the basic skills in a language from the data structures to objects/functions
(whatever floats your boat). You have to also most likely interact with
outside systems like I/O and databases (if your static blog generator is db
driven). You get to familiarize yourself with packaging/modules that the
language uses. So yea, I think creating a static blog generator as a next step
after hello world would be great

~~~
krapp
I completely agree. I'm still working on my own but already i've learned a lot
(among which, it's a bit more difficult than I expected.)

------
inovica
I like the idea of generating as many of our site pages as 'static' as we can.
We created our own system for our needs but I am seeing a lot more of this as
I look around. What I'm curious about is how people tend to handle dynamic
content?

~~~
dugmartin
If you put Varnish in front of your site you can use edge side includes to
populate the dynamic fragments of your site. Since it is Varnish you can also
cache the fragments themselves.

<https://www.varnish-cache.org/docs/3.0/tutorial/esi.html>

~~~
inovica
Thank you. I've seen Varnish but never used it. I will give this a go.

------
cerales
I love seeing the source for such elegant single-purpose projects like this.
I'm in the middle of writing my own static site generator for Python; it's a
bit more feature-rich, but it's up at something like 800 LOC for the minimum
feature-complete implementation. Great to see evidence that I have a long way
to go..

~~~
keithpeter
Yes, I've learned a lot seeing how different people are approaching the static
web page publishing job. I'm at the other extreme, a couple of bash scripts to
push markdown files through markdown and add header/footer then push the
changed ones out to the Web.

------
gbog
Seems nice but at first sight the code needs a bit more checks. There is a
rmtree on a config parameter that could delete all your content if the tool is
misconfigured.

~~~
daeken
I thought about mitigating that, as it could definitely have some nasty
effects, but couldn't come up with a decent way to do so. Hopefully, people
won't misconfigure it too often!

------
srgpqt
Since we're talking about minimalistic static site generators, here's the one
I wrote a while back: <http://srgpqt.github.com/Wakefile/>

It's a 74 line Makefile (or 174 with generous spacing and comments) with
rubygems and node module support.

------
jimktrains2
I wrote something similar: <https://github.com/jimktrains/gus>

I like the flexibility of gus and the ability to create custom index files
(for tags, by date, &c) and run preprocessing on asset files.

It also has a watch option, but at the moment that acts a little wonky and I'm
working on fixing it.

One of my end goals is to create a search index and then use that server-side
or ideally via JavaScript on the client.

Here is an entry I wrote about it: <http://jimkeener.com/posts/first>

------
forlorn
These days most people prefer spend some time to create thier own static blog
generators than use popular products like octopress or nanoc.

And that's great.

------
marban
I wrote a Tumblr (=Editing backend) to static S3/Cloudfront script on App
Engine for my linkblog. If there's some interest I might put it on Github.

------
stef25
What's the difference between a static blog generator and something like WP's
blog system, or Posterous? Bit confused by the terminology.

~~~
daeken
Rather than a web app that runs and serves up content dynamically, this just
spits out HTML that your webserver can serve up. No additional surface area
for attack, no need for caching to keep things efficient, etc. Super simple.

~~~
stef25
Cool. So there is no DB involved at all for the content? When you edit, the
old file is replaced by the a new one? I guess there is a backend you log in
to and a wysiwyg for editing?

~~~
kmfrk
Yup. The only problem is with using shorturls (since there no DB object ID to
map to).

~~~
grey-area
You could have your static generator create symlinks for each post at the
short url pointing to the actual page at the canonical url to handle this, and
set your server up to follow symlinks.

Alternatively it could generate a table of redirects for you to put in your
server config/htaccess.

~~~
kmfrk
Is this possible on S3?

~~~
grey-area
No idea I'm afraid, it depends on their setup. I used it as one approach when
generating a static blog a while ago under Apache, but there are plenty of
options (using config redirects, using symlinked pages or dirs, using
duplicate html pages with rel=canonical, using js redirects in extra html
pages), and I'm sure some if not all of them would work on S3. As long as
you're generating statically anyway, you can always add another step to
generate all your short links automatically too in whatever form works on your
server...

------
graue
Cool. Any plans to add an RSS feed? Your blog is really interesting, so I'd
like to subscribe, but I probably won't remember to come back and check it
manually.

~~~
zeckalpha
This is an all too common issue with roll-your-own static site generators.
There are quite a few blogs in this category.

Maybe there is space for something like that uses HTTP responses to check for
changes, and generates RSS.

~~~
graue
No need for it to be an issue though. Generating an Atom feed is dirt simple.
I wrote my own Jekyll template to do it:

<https://gist.github.com/graue/5184195>

The only Jekyll-specific stuff is the first three lines and the `{{ .. }}` and
`{% .. %}` templating code.

(For those who don't know, Atom is the better, cleaner replacement for RSS,
supported by virtually all RSS readers. I like to promote RSS since people
know what that means, but when I go and actually implement it, I spell RSS
"Atom".)

------
brunorsini
This seems interesting, but I recently got started with Kirby and will likely
stick to that for the time being.

~~~
danjessen
I have mixed feelings about static site generators on one hand i really like
the geeky approach where you make everything yourself and build it all from
scratch and you fiddle around in the terminal ... on the other hand im really
lazy and just want to push a button and it just runs.

And I think that is why I love the idea and concept of Kirby. It's PHP yes,
but I this case I don't really think that, that is a bad idea. I wan't my blog
to be easy and cheap to host. And a PHP hotel is easy and cheap. With Kirby
you build your site and upload it to some random host and it just runs. No
need to setup S3 or Github commit and push.

So thumbs up to Kirby, it suites my lazy habits.

------
JimWestergren
I recommend you to change the URLs: use dash to seperate words and all
lowercase.

------
antidaily
Very cool. URLs are a little funky (underscores).

