Costa Michailidis
Costa Michailidis

Reputation: 8188

Custom HTML in Jade Template

I'd like to accomplish something in jade, but not sure on the best approach. I want to have several product pages on a website, and most of these product pages will have the same layout and design, so I'm going to create one jade template. However, I would love to be able to insert some custom HTML for a couple of product pages in particular.

Can I use an include or something to optionally add custom HTML?

Upvotes: 0

Views: 318

Answers (1)

Robert Moskal
Robert Moskal

Reputation: 22553

You could use jade partials to show different snippets depending on some conditions in the templating context:

if user.description
    !=partial(template name[, options])

Or you might use template inheritance and render a different template depending on the same conditional, but this time in your controller. I would probably do the latter.

Upvotes: 1

Related Questions