O'Reilly logo

Grunt Cookbook by Jurie-Jan Botha

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Adding data to the site

Quite often we'll find that the majority of the content on a site repeats a pattern, and that only certain parts of the content differ from page to page. A site that displays articles for instance, will display each article using the same layout, and also have them listed in a repetitive manner. As developers, we'd probably like to avoid having to create each of these similar structured pages or items by hand.

For this purpose it's usually recommended to store the content we like to display in this fashion as data, which we can then render using a template or layout that will present each of them with the same template.

Getting started

In this recipe we'll continue working with the project from the Adding content to the site ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required