How to add meta, link, script, and other elements to the page headThe geek factor on this tutorial is fairly high, so unless you already know what a meta tag is you probably want to skip this tutorial. You have been warned. Ok... so you have a page that needs a custom meta, link, or script tag in its head. You're stuck because the engineering sites' wrap engine (the scripts that assemble the page) automatically constructs the head elements for each page, and you can't add your own head to the page because then there will be 2 heads in the rendered document. 2 heads are, of course, an abomination. Fear not; there are ways to do this, and if you already know how to construct the tags you want to add, you won't need any esoteric new knowledge. link and script tagsYou can insert any link meta tags or script blocks that you need by putting them into a head_content property on your page:
meta tagsThe wrap engine will check your page's properties to see if 3 specific properties exist:
If it finds one of those properties, the value of the property is inserted into the content of the meta tag, replacing the default value. Note that unlike the head_content property, which inserts it's contents exactly as you enter them, the meta properties insert their values into the content attribute of an existing meta tag. For example: Property name: meta_description If you type the entire tag into the property value, you'll wind up with a malformed tag like: <meta name="description" content="<meta name="description" content="This is the description of the page" />" /> Caveats:If your page is a DTML Method you will first need to convert it to a DTML Document so that it will have properties. One place where this can trip you up is if you are trying to add head tags to a wrap5 school or program home page. Most of those situations will have a DTML Method named "homepage_content" that is pulled into the site's root "index_html" object. In that case, the property must be added to the home folder's index_html, not homepage_content. Yeah, I know it's counter-intuitive. Wrap6 should improve things. -Hilary Mark Nelson, hmnelson@purdue.edu |