Copied to clipboard

Flag this post as spam?

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


  • Erik Jan 2 posts 22 karma points
    Nov 01, 2009 @ 12:57
    Erik Jan
    0

    Documentype question

    Hi,

    I'm a new Umbraco user and loving it so far. I got a question about documenttypes. I have a "Master" documenttype and several child documentypes. Now i want to save time and work by putting content in the Master page and let the child inherit the content. Ok so far so good.

    Now for example i want to set the html meta tag only in the Master page. I made a tab called Meta Data in the Masterpage and let the child inherit it. The problem is that for every child made i have to insert the content manually otherwise the content wont show.

    For the title i made a macro and that works for every child page. Is there a way to set a tab only for the Master page for things like this?

     

    Code Child:

    <%@ Master Language="C#" MasterPageFile="/masterpages/MasterPage.master" AutoEventWireup="true" %>

    <asp:Content ContentPlaceHolderId="MasterPageContentPlaceHolder" runat="server">
    <!-- Insert "MasterPageContentPlaceHolder" markup here -->
    <umbraco:Item field="bodyText" runat="server"></umbraco:Item>
    </asp:Content>

     

    Code MasterPage:

    <%@ Master Language="C#" MasterPageFile="/umbraco/masterpages/default.master" AutoEventWireup="true" %>
    <asp:Content ContentPlaceHolderID="ContentPlaceHolderDefault" runat="server">
    <html>
    <head>
    <title><umbraco:Macro Alias="pageTitle" runat="server"></umbraco:Macro></title>
    <meta name="description" content="<umbraco:Item field='metaDescription' runat='server'></umbraco:Item>" />
    <meta name="keywords" content="<umbraco:Item field='metaKeywords' runat='server'></umbraco:Item>" />
    <meta http-equiv="Content-Type" content="text/html" />
    </head>
    <body>
    <!-- Start of child template -->
    <asp:ContentPlaceHolder runat="server" id="MasterPageContentPlaceHolder">
    <!-- End of child template -->
    </asp:ContentPlaceHolder>
    </body>
    </html>
    </asp:Content>
  • Masood Afzal 176 posts 522 karma points
    Nov 01, 2009 @ 13:40
    Masood Afzal
    1

    set 'recursive' to true in umbraco:Item

    e.g.

    <umbraco:Item field='metaKeywords' runat='server'  recursive="true"></umbraco:Item>
  • Erik Jan 2 posts 22 karma points
    Nov 01, 2009 @ 13:48
    Erik Jan
    0

    Wow how could i have overlooked that. I feel stupid :). Anyway thanks for the help.

Please Sign in or register to post replies

Write your reply to:

Draft