Where to put code in the HTML <head> ?

Topics: General
Aug 24, 2011 at 6:46 AM

I have these codes. How do I include this in the page?


<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>blah blah</title>
<meta name="Keywords" content="blah blah, blah" />
<meta name="Description" content="blah blah" />
<meta name="rating" content="General">
<meta name="Expires" content="never">
<meta name="language" content="english">
<meta name="charset" content="ISO-8859-1">
<meta name="distribution" content="Global">
<meta name="revisit-after" content="10 Days">
<meta name="email" content="inquiry@blah.com">
<meta name="author" content="blah Corporation">
<meta name="publisher" content="blah Corporation">
<meta name="copyright" content="Copyright ©2005">
<link rel="stylesheet" href="./blah.css" />
<script language="javascript" type="text/javascript">
function popDemo(){
function popVideo(){
function open3DView(){



thank you

Aug 24, 2011 at 6:47 AM

Check out the code of the Vandelay.Meta module for an example of how to do this.

Aug 24, 2011 at 9:36 AM
bertrandleroy wrote:

Check out the code of the Vandelay.Meta module for an example of how to do this.

thanks Bertrand. That is for the meta tags but how about for the javascript?

Aug 24, 2011 at 1:55 PM

There are two ways to do that. If you want to include script directly in the <head> like that, you can do this in your view template:

@using (Script.Head()) {
    <script language="javascript" type="text/javascript">
        //your script here

Or, if you want to have your script in a separate file referenced in a <script src="..." /> tag in the <head>, you can do this:

Where "yourScript.js" exists in a Scripts folder of your module or theme.