Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

node.js jade - how do I set the content type in jade

node.js jade - how do I set the content type in jade

Problem

I have a view in which the MIME type returned varies. How do I set the content type in the head section?

Here is what I am trying to do

!!!
html
  head
    title #{site.title} - #{site.version}
    link(rel='stylesheet', href='/stylesheets/style.css')
    script(type='text/javascript', src='/javascripts/jquery-1.5.1.min.js')
    content-type #{mimetype}
  body!= body
Problem courtesy of: MattM

Solution

You can specify the content-type meta tag like so:

meta(http-equiv="content-type", content="#{contentType}; charset=UTF-8")

Remember that the tag for content-type is

Solution courtesy of: jcolebrand

Discussion

View additional discussion.



This post first appeared on Node.js Recipes, please read the originial post: here

Share the post

node.js jade - how do I set the content type in jade

×

Subscribe to Node.js Recipes

Get updates delivered right to your inbox!

Thank you for your subscription

×