Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Jason 86 posts 156 karma points
    Jul 22, 2013 @ 14:31
    Jason
    0

    Newbie....trying to add to <head> in master file....won't work.

    Hello,I'm new to Umbraco and am trying to find my way around.I was asked to add this code to the head tag, however, I do not see it in the master file for the page.  How do I add it without breaking the page, because that's what happens when I try.Here's the code I'm trying to add to the head tag:<link rel="canonical"href="http://online.saintleo.edu/the-saint-leo-experience/online-degree-programs.aspx" />Here's my master page code:<%@ Master Language="C#" MasterPageFile="~/masterpages/Main.master" AutoEventWireup="true" %><%@ Register Namespace="UmbracoBreadcrumb" TagPrefix="Crumb" %><script runat="server">    int b = 0;    int degreeCount = 0;    protected void Page_Load(object sender, EventArgs e)    {        XmlNodeList degrees = UmbracoItem.CurrentPage.SelectNodes("DegreeRouterPage");        degreeCount = degrees.Count;        b = degreeCount % 2 == 0 ? degreeCount / 2 : (degreeCount / 2) + 1;        DegreeRepeater.DataSource = degrees;        DegreeRepeater.DataBind();    }</script><asp:Content ID="Content1" ContentPlaceHolderID="PageStyles" runat="server"><style>#scenic-bg{ background-color: #<%=XPathBinder.Eval(UmbracoItem.CurrentPage, "ancestor-or-self::* [@level='2']/scenicBackgroundColor") %>; background-image: url(<%=XPathBinder.Eval(UmbracoItem.CurrentPage, "ancestor-or-self::* [@level='2']/scenicBackgroundImage") %>); background-position: 50% 0; background-repeat: no-repeat;}</style></asp:Content><asp:Content ID="Content2" ContentPlaceHolderID="PageScripts" runat="server"> <script type="text/javascript" src="<%=VirtualPathUtility.ToAbsolute("~/scripts/libs/jquery.color.js") %>"></script></asp:Content><asp:Content ID="Content3" ContentPlaceHolderID="BackgroundScene" runat="server"><div id="scenic-bg"></div></asp:Content><asp:Content ContentPlaceHolderID="MainContent" runat="server"><div id="page-body" class="inner standard">    <div id="primary-content">        <Crumb:UmbracoBreadcrumbMenu CssId="breadcrumb-navigation" ShowRootNode="true" RootNodeTitle="Home" ShowCurrentNode="true" LinkCurrentNode="false" ID="breadcrumb" runat="server"></Crumb:UmbracoBreadcrumbMenu>        <% if (!string.IsNullOrEmpty(UmbracoItem.Get("academicsRouterBillboardPhoto"))) { %>        <div class="billboard">            <div class="copy-container">                <p class="marketing-headline tk-ff-meta-web-pro"><strong><umbraco:Item Field="academicsRouterBillboardPhotoHeadline" runat="server" /></strong></p>                <p class="marketing-copy"><umbraco:Item Field="academicsRouterBillboardPhotoCopy" runat="server" /></p>                <% if (!string.IsNullOrEmpty(UmbracoItem.Get("academicsRouterBillboardPhotoLink")))                   { %>                <p class="learn-more"><a href="<%=umbraco.library.NiceUrl(Convert.ToInt32(UmbracoItem.Get("academicsRouterBillboardPhotoLink"))) %>"><umbraco:Item Field="academicsRouterBillboardPhotoLinkText" runat="server" /></a></p>                        <% } %>            </div>            <img class="billboard-photo" src="<%=UmbracoItem.Get("academicsRouterBillboardPhoto") %>" alt="<%=UmbracoItem.Get("academicsRouterBillboardPhotoAltText") %>" />        </div>        <% } %>        <div class="line">            <div class="inner">            <h1 class="tk-ff-meta-web-pro"><umbraco:Item Field="pageName" runat="server" /></h1>            <% if (!string.IsNullOrEmpty(UmbracoItem.Get("academicsRouterIntroCopy")))            { %>            <p><umbraco:Item Field="academicsRouterIntroCopy" runat="server" /></p>            </div>            <% } %>        </div>        <hr class="star" />        <div class="line router-sub">        <asp:Repeater ID="DegreeRepeater" runat="server">            <HeaderTemplate>                <div class="col half">                    <div class="inner">            </HeaderTemplate>            <ItemTemplate>                <asp:PlaceHolder id="P1" runat="server" visible='<%#Container.ItemIndex > 0 && Container.ItemIndex % b == 0 && Container.ItemIndex != degreeCount - 1%>'>                    </div>                </div>                <div class="col half<%#Container.ItemIndex / b == 2 ? "last-col" : "" %>">                    <div class="inner">                </asp:PlaceHolder>                            <div class="section">                            <h2><%#HttpUtility.HtmlEncode(Convert.ToString(XPath("@nodeName"))) %></h2>                            <p><%#XPath("routerIntro")%><br />                            <a href="<%#umbraco.library.NiceUrl(Convert.ToInt32(XPath("@id")))%>">View <%#HttpUtility.HtmlEncode(Convert.ToString(XPath("@nodeName"))) %> &raquo;</a></p>                            </div>            </ItemTemplate>            <FooterTemplate>                    </div>                </div>            </FooterTemplate>                  </asp:Repeater>        </div>    </div>    <div id="sidebar-left" class="aside">        <div class="nav">            <h2 class="<%=Convert.ToString(XPathBinder.Eval(UmbracoItem.CurrentPage, "ancestor-or-self::* [@level='2']/@nodeName")).Replace(' ','-').Replace("&","and").ToLower() %>"><a href="<%=umbraco.library.NiceUrl(Convert.ToInt32(XPathBinder.Eval(UmbracoItem.CurrentPage, "ancestor-or-self::* [@level='2']/@id"))) %>"><%=XPathBinder.Eval(UmbracoItem.CurrentPage, "ancestor-or-self::* [@level='2']/@nodeName") %></a></h2>            <elliance:UmbracoListMenu StartLevel="2" id="SecondaryNav" runat="server" MenuName="Main" CssId="secondary-navigation"/>        </div>        <saintleo:LeftCallouts ID="LeftCallouts1" runat="server" />    </div></div></asp:Content>

  • Jason 86 posts 156 karma points
    Jul 23, 2013 @ 19:54
    Jason
    0

    Anyone?

  • [email protected] 378 posts 1915 karma points MVP 4x c-trib
    Jul 23, 2013 @ 20:07
    jeffrey@umarketingsuite.com
    100

    Hi Jason,

    you won't find the <head>...</head> code in here, because this masterpage uses another masterpage called /masterpages/Main.master (see the first line). You'll probably find the <head>-tag here and you can add your code.

    Greetings Jeffrey

    p.s.: It will probably also work if you place it in the ContentPlaceHolderIDs PageStyles or PageScripts because they'll probably be inserted into the head.

    p.s.2: Try to format the code next time. It will make it a lot easier to read :)

  • Jason 86 posts 156 karma points
    Jul 23, 2013 @ 20:29
    Jason
    0

    Jeffrey,

     

    First, I'm sorry about the formatting........I copied and pasted and should have cleaned it up.

     

    Secondly, thank you so very much for your response.

     

    I copied the code beneath the first ContentPlaceHolder and it made it into the head.

     

    You're awesome!

     

    Kind regards,

    JK

  • [email protected] 378 posts 1915 karma points MVP 4x c-trib
    Jul 23, 2013 @ 20:39
    jeffrey@umarketingsuite.com
    0

    No problem Jason! Please mark the my post as "Solved" so the topic can be closed.

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies