What’s the least redundant way to make a site with JavaScript-generated HTML crawlable?

Why didn’t I think of this before! Just use http://phantomjs.org. It’s a headless webkit browser. You’d just build a set of actions to crawl the UI and capture the html at every state you’d like. Phantom can turn the captured html into .html files for you and save them to your web server. The whole … Read more

Dealing with an empty list in mustache.js

After struggling for half a day with this problem, I’ve finally found an easy solution! Don’t check for the list, but check if its first item is not empty! Template: {{#persons.0}} <h2>Persons:</h2> <ul> {{#persons}} <li>{{name}}</li> {{/persons}} </ul> {{/persons.0}} {{^persons.0}}No persons{{/persons.0}} Data: { “persons”:[ {“name”: “max”}, {“name”: “tom”} ] } Output: <h2>Persons:</h2> <ul> <li>max</li> <li>tom</li> </ul> … Read more

Handlebars partial vs. render vs. template

The way I understand it, the way they break down is like this: “render” gives you an entire view/controller/template context of its own to work with. An example will be a top navigation that includes dynamic pieces. The content will be maintained within a TopNavController and inserted into the application template using “render” “partial” will … Read more