This project is read-only.

Where to put code in the HTML <head> ?

Topics: General
Aug 24, 2011 at 7: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="">
<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(){"blast-blah.html","blast","width=600,height=240");
function popVideo(){"blahair-vid.html","vid","width=352,height=260");
function open3DView(){"3dview.html","3d","width=320,height=240");



thank you

Aug 24, 2011 at 7:47 AM

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

Aug 24, 2011 at 10: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 2: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.