
Show HN: A dead simple static site generator – just two template tags - colevscode
http://tags.brace.io
======
kurrent
I'm not being facetious, but this "yet another static site generator" joins
the list with 230+ other generators.

(see [http://staticsitegenerators.net/](http://staticsitegenerators.net/))

Why do we need another one?

~~~
jedberg
Static site generators are the new Fibonacci generator. When you learn a
language it's a fun little exercise, and possibly even useful.

Also, everyone has slightly different requirements, so everyone likes to build
their own.

I will most likely soon build my own static site generator, because none of
the ones out there do exactly what I want. I will most likely borrow from at
least a few of the examples out there and then post it on my github so there
is yet another one.

I think we're seeing a proliferation simply because it is so easy to share
code these days. Imagine how many Fibonacci generators would have been out
there if it were as easy to share code when those were popular (I want to say
10 years ago but maybe it was longer).

~~~
ianstormtaylor
Had the same problem ourselves while building Segment.io that every static
site generator was a bit too opinionated in weird ways, so we made
Metalsmith[0]. Check it out, and you might not need to make your own anymore
:)

[0]: [http://www.metalsmith.io/](http://www.metalsmith.io/)

~~~
xixixao
Ian how does it compare to gulp? Build tools with name-plugin-name are another
proliferating area :).

------
bryanlarsen
You could use server side includes instead, which have been a feature of web
servers for about 20 years now...

~~~
icebraining
Not if you host on S3, for example.

~~~
TheZenPsycho
A legitimate problem we're solving by… inventing a new templating language.

Did we need a new one to do this? Absolutely none of the hundreds of existing
languages could have possibly worked, so let's reinvent SSI with different
syntax?

------
steve_barham
Not Invented Here syndrome, at all? Sure, I understand wanting to use Python
for templates rather than relying on an external application. But why ignore
the many, many existing template libraries? Some of those libraries have
solved problems which you don't realise you have yet.

Case in point, are you planning to support this 'dead simple' template
language for users of your hosting site? If so, what happens if I try to
include something outside the site root, in a Dropbox area which I control?
[https://github.com/braceio/tags/blob/master/tags/tags.py#L13](https://github.com/braceio/tags/blob/master/tags/tags.py#L13)

~~~
colevscode
Fair point. Python was chosen because it's an accessible language for new
programmers. As for template languages, most are very complex. We wanted
something minimal.

As for that case, it won't work and we'll try to help you reorganize your
content so it does. :)

------
laurent123456
I've been using PHP to generate static HTML pages. It's usually as simple as
`php somepage.php > somepage.html` and you have all the advantages of a full
featured language.

------
tghw
Don't use easy_install.

[http://stackoverflow.com/a/3220572/2363](http://stackoverflow.com/a/3220572/2363)

~~~
colevscode
We totally agree, and use pip and virtual envs for everything.

However we chose python, and easy_install because it's pre-installed all
macbooks going back to snow leopard. (specifically python 2.6.1 which comes
with distutils needed for our setup.py file) This means for many web
designers, brace-tags doesn't require that you update your python install, or
really know python at all. It's the simplest command line install experience
we could come up with.

~~~
tghw
Then suggest pip first. If they need pip, they can easy_install it.

------
moondev
Reminded me of my go-to include method from back in the day:
[http://www.moock.org/webdesign/javascript/client-side-
includ...](http://www.moock.org/webdesign/javascript/client-side-include/)

~~~
alanfalcon
Stupid question: any major drawbacks to using this method?

~~~
moondev
Lots.

The "include" file is just a js file that document.writes your html, so its
not easy to make edits because you would need to do it in a big stream of
escaped code.

They won't work if user has js turned off.

They are awful for seo because the includes will not be there when the page is
crawled

They are not semantic for writing things like <html><head> and will throw your
browser into quirks mode because your page would effectively start with a
script tag.

But I used the hell out of them back when dynamic hosting was hard to come by
(geocities, tripod etc)

~~~
alanfalcon
Thanks!

I'm in the fun position of essentially being a graphic designer made to be a
web designer in a stingy startup environment where they don't want to pay
someone to actually code things. Another designer and I put together a very
sad website, and I wouldn't mind having a system for having includes for my
header and footer, but even simple concepts like preprocessing scare me off.
Heck, I run scared at the mention of the command line. I guess the only real
answer is to bite the bullet and learn this stuff (I do frequent HN after all,
you'd think I'd be more comfortable with some of these concepts).

~~~
krapp
Yeah, "biting the bullet" is probably a good idea. As someone with a graphic
arts degree who's been a "web designer" for years, I can tell you the
potential for making money at anything entirely with front-end and design
skills seems vanishingly small. The days when having an ftp account and
Notepad were all you needed are long, long gone.

I know enough git to be able to manage the basics (pulling and pushing) and a
bit of command line stuff. If you ever get into working with web frameworks in
just about any language, I think those are going to be kind of essential. It's
probably not going to be as scary as you think though.

------
newaccountfool
What's the reason for this? Why don't you just build the website using
standard HTML? Genuine question.

~~~
CJefferson
I was looking for something exactly like this just recently. Usually I use
just php include when I want to just links some files together, but felt like
I should stop using php as a preprocessor if possible.

However, everything else is so complicated if all you want is simple file
inclusion.

~~~
newaccountfool
What's the reason behind not using PHP?

~~~
mokkol
You need PHP installed and configured on your server/local. With this you can
just use plain HTML.

~~~
icebraining
In theory you could also use PHP as a pre-processor; install it locally, copy
the sources to the webserver root, then use wget --mirror to extract a post-
processed version of the site.

You'd still need PHP installed on your home machine, but then again, it's not
like you don't have to install some pre-processor anyway.

~~~
cowsandmilk
> use wget --mirror to extract a post-processed version of the site.

or just use php file.php > file.html

~~~
icebraining
Sure, but you'd need to process each file, or write a script to do it, when
wget --mirror fetches the whole site at once.

------
dangayle
I like this very much. I used to do very similar with PHP, but I'm now a
Python dev. Sometimes, just sometimes, writing plain old simple html is
easier, and having a basic include would save a ton of heartache for
maintenance.

------
epsylon
I'm willing to bet that it took more time to write and setup the homepage than
to write the generator itself.

------
Kiro
I haven't read everything but why isn't the source like 10 lines if that's all
it does?

~~~
icebraining
Reading the source, it also has a built-in web server (based on Python's
SimpleHTTPServer) and a file watcher to automatically rebuild the site.

~~~
keithpeter
So the watcher only writes files that have been edited unless there is a
change to one of the repeated tag files?

~~~
icebraining
I think it rebuilds the whole site - I don't see any logic for identifying the
changed file and rebuilding only that.

------
workhere-io
Is there any way you could make the watch feature not dependant on watchdog?
The watchdog installation fails on pip on Mac. I then had to install Homebrew
just to be able to install libyaml, which then meant I could install watchdog.

~~~
xixixao
Which is why this should have been written in Node. Seriously, Python/Ruby
environments+package managers are the abomination of programmer's time.

~~~
workhere-io
I disagree. This is the only time I've ever had any problems with Python
package managers.

------
rooodini
I actually found the “Highlight this” example at the top a bit confusing.
Could you write “Display this” instead? Or give a better example to
demonstrate conditionals?

------
LouisSayers
I like it! Great concept, thanks for simplifying something that should be dead
easy and simple. A ruby port would be nice.

------
dolphenstein
Awesome! Just what I needed this morning.

------
workhere-io
Very nice and easy to use.

