Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Show HN: Gugodoc, my static web generator (for what it's worth ) (gugodoc.free.fr)
20 points by MeyerDumont on Jan 22, 2014 | hide | past | favorite | 29 comments


Funny, I'm almost done with a fork of a Clojure static web generator and I really went into the opposite direction. What I wanted was to have one (or several) html files as templates that I do not need to break up into parts and that are not plastered with weird template tags. So I'm using Enlive to define selectors and the generator uses theses selectors to fill the content into the html structure. That makes it really really easy to edit the html for the blog without having to go the html -> haml/whatever -> break up -> ... route. I just relaunched my blog with this generator and it feels so liberating that I can just work in html without having to do any kind of conversation afterwards but the content is applied.

I'm currently extending the tests for the generator, and will release it then. If anyone is interested, drop me a note and I'll notify :)


your solution sounds really good.


I just published the generator. You can see the relevant HN post here: https://news.ycombinator.com/item?id=7103742


Is there something like this that operates at a higher level? Unlike the author, I'm ok with HTML (and I can't stand markdown), except that it's too low level. I want to break things up by title, author, date, summary, content, etc. and then generate the HTML by plugging it into a template, so that title, date, and author become part of the heading at the top of the page and so on. So something like

<title>...</title> (pretend this isn't already taken) <author>...</author> <date>...</date> <summary>...</summary> ...

It seems like XSLT is what I want, except that I have to deal with a bunch of XML nonsense. I could always write my own parser, but I keep hoping someone already wrote something like this.


What you're talking about can be pretty easily implemented with template inheritance that uses blocks/sections. Pretty much any templating language can do this for you (usually static site generators use templating languages, so by extension, static site generators will do this for you as well). For instance, jinja2 is a common one for Python that I use for my website.

You can read about jinja2 template inheritance in their docs [1]. The gist of it is that you can define a layout in HTML, with placeholders for specific things like the title, author, content, etc. Then your actual post is just a file that inherits from that layout template and only defines the relevant blocks. So in "template pseudocode" your page might look like this:

    {{ extends site_layout }}
    {{ block title }} Title here {{ endblock }}
    {{ block author }} delluminatus {{ endblock }}
    {{ block content }} 
        <p>Content!</p>
    {{ endblock }}
[1]: http://jinja.pocoo.org/docs/templates/#template-inheritance


> I could always write my own parser, but I keep hoping someone already wrote something like this.

Not the parser, just the transformation phases. Maybe something like the Haskell XML toolbox or Clojure data manipulations (XML -> clojure data structure -> munge[0] -> XML) would work for you.

[0] basic options: Enlive, or parse XML to Hiccup and manipulate Hiccup tree before serialising back.


Funnily I have been building something similar, but using JSON as the data source with compilation step either AOT or at run time. It's quite fun though very rough, and I can see why XSLT is more complicated than you'd expect.


Not entirely sure I understand what you're after, but the Harp js framework can do just about anything. If your metadata is in json or just encoded by folder/file even, you can inject it into templates easily.


  I'm a big fan of minimalism.
  I love markdown
  I hate HTML
If you hate HTML, are you sure you should write something that outputs exactly that?


> If you hate HTML, are you sure you should write something that outputs exactly that?

He probably mean to write HTML.


ama729 is right. I hate writing HTML and that's why I try to automate this task as mush as possible


How is this different from Octopress? In Octopress you can simply edit markdown files and then generate html.


I don't know Octopress, this is just my tool and it's probably worst than all the others but it fits my needs


Just for fun is a perfectly good reason for anything!

Also, I have saved a lot of time looking around for existing solutions than just doing it myself. :)


Just saw a little bit Octopress, it seems you need a local server to see your files, I don't like that, Gugodoc produces only static html files. you just need to open them with a browser and that's all


The server part in Octopress (and other static site generators are there just for convenience and to and see how it really works when you host the site I guess.)


Not sure, If you don't run the server you can't see anything because often the templating is done by the server


The Octopress generates static html. No templating at server side. You can host output html to any static host like github pages.


Dans la section HTML and Bootstrap, la phrase suivante contient au moins deux fautes : "But, of course, I discourage you fro doing this because, in my opinion, markdwon files must try to be as lisible/raw/text only as possible."


merci !


where is the source code?


It's too ugly but I will probably try to clean it and put it on github soon.


I'm not going to run your binary if I can't see the source and compile it myself!


I understand that. I will try to publish to source code very soon then.


What language do you use ?


Python then Pyinstaller to create binaries for each platform.


As already mentioned, I'd prefer run python scripts with my own interpreter. I promise, I won't look at your code ;-)


Pretty much impossible to read on phone with that floating shit blocking your view.


Thanks for the feedback, I will try to fix that ASAP.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: