Copied to clipboard

Flag this post as spam?

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


  • Damon 217 posts 288 karma points
    Jul 21, 2015 @ 09:11
    Damon
    0

    Can content from a tab on the home page be propagated to other pages that use different template and doctype?

    Hi,

    I have a master template and a home template that inherits from it.

    In the home document type I have a footer tab for footer links.

    I only want this tab one the home document type.

    Is it possible therefore to use the content from this home tab to populate the footer links on other page that use a different template? The footer is in the Master template by the way,

    Thanks!

  • Nik 1608 posts 7234 karma points MVP 7x c-trib
    Jul 21, 2015 @ 09:19
    Nik
    0

    If I understand you correctly then I believe yes. You would need to alter your master template so that when it renders the footer section it looks up the content tree to the home page.

    Assuming your content tree looks like this:

     Home 
         -> Second Page
         -> Third Page
    

    And assuming that you are using Razor (as I'm not certain if you can do it with the old approach) you should be able to call

    @CurrentPage.Site()

    This should give you the home page of the current site in your template and allow you to access the footer properties.

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Jul 21, 2015 @ 09:22
    Dennis Aaen
    0

    Hi Damon,

    Yes this is possible, to use data from the homepage into another pages. You could use the Umbraco content helpers @Umbraco.Field and make it recursive. The Umbraco Field returns the value of that field from the Current Page.

    https://our.umbraco.org/documentation/Reference/Querying/UmbracoHelper/

    Like this:

    @Umbraco.Field("bodyText", recursive: true)
    

    Or if you are in a partial view or a partial view macro you can use the AncestorOrSelf(1) to get the homepage node

    @CurrentPage.AncestorOrSelf(1)
    

    Or

    @Model.Content.AncestorOrSelf(1)
    

    Dependig if you are using dynamic Razor syntax or strongly typed Razor syntax.

    Hope this helps,

    /Dennis

Please Sign in or register to post replies

Write your reply to:

Draft