1

I made a Ruby on Rails web app in the past. Using RoR, there was a standard "template" that was used for each page, and the content that was inserted into the "template" was all handled on the server side. For example, I defined a standard header and footer, and when a request was made for a specific page, the content for that page would get inserted inbetween the header and footer and then served to the client.

Currently, I'm using Firebase as the back-end database, real-time update engine (pub/sub), and tool for hosting a different web-app. Firebase hosting simply serves up static HTML/JS files, and the clients perform all of the heavy lifting (unlike RoR) for authentication, DOM-manipulation based on user, etc.

In this app, I have a standard header and footer that is used on every page, but my issue is that any change to the header/footer has to be made manually to each page.

So, my question is, is there a standard method (or tool, perhaps) that essentially would let one build in a template fashion, and then automatically "compile" to the separate HTML files that I could then let Firebase host? I'm not necessarily looking to use something like AngularJS, although I think it inherently addresses the issue.

An app with a few pages is easy to manage, but as the app grows things get hairy quickly and ensuring consistency becomes a cumbersome task.

The question: Static site generator with GUI, I believe is close to what I'm asking, but not quite the same. I'm not looking for a tool to generate a static site, but a tool for editing HTML in a templated fashion (and not necessarily with a slick GUI, I was thinking more of a text-based solution like some sort of plugin for Notepad++). Jekyll was recommended as an answer to the linked question, and seems to be a potential good solution, but I thought I'd see if there were others.

2
  • "I'm not looking for a tool to generate a static site, but a tool for editing HTML in a templated fashion": Could you elaborate on where you see the differences here? … If I understand your case correctly, you want to create/edit HTML templates and use these templates to generate several static pages (which form a website) … which is exactly what static site generators do, isn’t it?
    – unor
    Commented Nov 1, 2014 at 1:22
  • After coming back and rereading my question and your comment, I guess those two are the same thing. At the time, I was thinking a static site generator tried to incorporate all of the web-server stuff as well, where I just wanted the static HTML files to host myself. But again, yes I think now those two are the same thing...
    – MandM
    Commented Nov 3, 2014 at 14:26

1 Answer 1

2

I think a static site generator is what you need.

They are typically (but not necessarily) command-line tools:

  1. You place template and content files in specific folders.
  2. You run the tool.
  3. You get the static HTML files.

You can now simply take all the generated HTML files and upload them.

There are so many solutions (see, for example, the lists on http://staticsitegenerators.net/ and https://www.staticgen.com/ to get an idea) that it’s hard to give a specific recommendation without specifying what exactly you expect from it.

Popular examples are Jekyll, Pelican, Middleman, and Hexo. I like Hugo, mostly because of its great built-in testing server with live reload support (see also my question), but I guess this doesn’t matter for you.
So when you think that a static site generator could be a solution for your case, feel free to create a new question (tagged with ) where you explicitly list which features you need, for example: Should it use a specific template engine? In which format (e.g., Markdown) do you want to write the content? Which kind of URL design should it use? Does it only need to generate HTML files? Should it create a feed? Do you have different "content types"? Should it minify the generated HTML? etc.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.