Copied to clipboard

Flag this post as spam?

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


  • Alexis 6 posts 87 karma points
    May 01, 2016 @ 20:50
    Alexis
    0

    How to allow child pages use a content tab from their parent (Umbraco newbie)

    Hi there,

    I'm new to Umbraco and am editing a website that has been set up in Umbraco previously (not by me)

    I am wondering if there is a way to set up a content tab on a parent docType which can be used by it's children.

    For example, below is a shot of the content structure of the site, as you can see, there is a content tab on 'BLOGS' called blog content.

    enter image description here

    But then, if I go into an children of the 'BLOG' This tab does not appear.

    enter image description here

    Please could you tell me the DocType/Template configuration that is needed to allow this content tab to be used by the children pages.

    I was able to make a tab that can be used by all pages by creating it on the 'Master' docType (Clients) - however, as this BLogContent tab would only be used by blog pages, I was wondering if there was a better way.

    Thanks for your help

  • Dennis Adolfi 1082 posts 6450 karma points MVP 6x c-trib
    May 01, 2016 @ 21:14
    Dennis Adolfi
    0

    Hi Alexis.

    Tabs are inherited by doc types and apparently the children and the parent in this case is not of the same doc type, therefore the children doesn't get the same tabs.

    You can easily just create the same tab and properties (like you've done one the master) but instead only do it for doc type that the children are using, thereby all nodes in your site doesn't have to have these tabs, just the blog. If you don't know what doc type these children are you can see it in the tab "Generic Properties".

    Best of luck to you!!

  • Alexis 6 posts 87 karma points
    May 02, 2016 @ 17:39
    Alexis
    0

    Hi Dennis,

    Thanks for the reply. Could you tell me what you mean by the children not being the same DocType as the parent?

    The DocType of each of the blog posts pages is different for example:

    enter image description here

    Whereas the parent has a DocType of 'blogs'

    I cannot change the DocType of the children as they are each their own page? Can I? If so, how can I change them?

    Thank you for you help

    Alexis

  • Dennis Adolfi 1082 posts 6450 karma points MVP 6x c-trib
    May 02, 2016 @ 17:51
    Dennis Adolfi
    0

    Does every blog post have its own doctype or are they all of a same doctype like "blogpost"? You'll need to create the tabs and properties for every doctype you'd want to use them.

    What version are you using? If your using 7.4+ or could upgrade, then you could use compositions to add tabs and props for doc types without having to re-create them for every doctype.

  • Alexis 6 posts 87 karma points
    May 03, 2016 @ 08:07
    Alexis
    0

    Hi Dennis,

    Here is a screenshot of all the different DocTypes enter image description here

    As you can see, they are all different

    enter image description here

    This is the DocType dettings of the main blog page, it has all the blog pages checked in 'allowed child nodetypes'

    As I mentioned, I did not create this site so I am unsure how these pages were created.

    Thanks, again

    Alexis

  • Dennis Adolfi 1082 posts 6450 karma points MVP 6x c-trib
    May 02, 2016 @ 17:59
    Dennis Adolfi
    0

    If your blogposts are of different doc types, do they all inherit the same doctype? Could you add the tabs and props to that doctype? Could you take a screenshot of your doc types in settings?

  • Dennis Adolfi 1082 posts 6450 karma points MVP 6x c-trib
    May 03, 2016 @ 08:40
    Dennis Adolfi
    0

    Ahh, i see. So all your doctypes are directly under Master. Since tabs and properties are inherited through parent doctypes and not by specifying child nodetypes, then i think you are left with these option:

    1. Add the tabs and properties to the Master doctype. Not the best fix for you since it will affect all DocTypes, not just the blog doctypes.
    2. Add the same tabs and properties for every blog doctype. This might be very timeconsuming and redundant, and not very fun to maintain since you will have the same properties declared on several different places. But if its not too many properties, i think this might be your best option.
    3. Upgrade to Umbraco 7.4+ and use compositions. More about compositions here: http://letswritecode.net/articles/document-type-compositions-in-umbraco/

    I understand that you are left in kind of a pickle since its not you who created this site. Maybe someone else in this great forum has another solution, but these where the ones i could think of.

    Best of luck to you!!

  • Dennis Adolfi 1082 posts 6450 karma points MVP 6x c-trib
    May 06, 2016 @ 06:53
    Dennis Adolfi
    0

    Hi Alexis.

    Im curious, which way you decided to go with this, did it work out for you? Is there anything else i can help you with?

  • Alexis 6 posts 87 karma points
    May 06, 2016 @ 11:25
    Alexis
    1

    Hi Dennis,

    In the end, I decided to delete the pages that were made previously because they were created in such a way that they had no parent docType other than master which meant that every time we want to add a new blog page (which will likely be weekly), we'd have to create a new page, create generic properties and content tabs on the this page, fill in the template with the correct code as well as assign the blog post pages to the main blog splash page's code, individually by name/id.

    I thought it would be best and would save efficiency in the long run to start again. (sorry guys)

    So, I created a master docType for my blog pages called blogMater enter image description here

    From here I created the content properties which will be common to all blog pages

    enter image description here

    Now, all the child pages of this document type will be able to use these properties.

    To make these visible in the content tab, I assign every new blog page as a child node of 'Blogs' (this is the main blog splash page)

    enter image description here

    Now I can create a new page for any of these, as long as there is a docType correctly assigned as a child node of the Blogs page.

    And, within the blog splash page code, I can reference my common properties without worrying about making a spelling error on one of the pages' content properties

    enter image description here

     <div class="blog-item">
                      <div class="row ">
                          <article class="rsk-article">
                              <div class="small-12 medium-5 large-3 columns">
                                  <div class="article-thumbnail" style="background-image: url(@imgSrc);">
                                      </div>
                               </div>
                               <div class="small-12 medium-7 large-9 columns">
                                    <h6 class="normal-heading-light">@item.GetPropertyValue("title")</h6>
    
                                    <p class="basic-paragraph">@(item.GetPropertyValue("shortDescription") == null ? "" :item.GetPropertyValue("shortDescription").ToString() )<a href='@item.Url'>...read more</a>
                                    </p>
                                    <span class="posted-by">Posted By @(item.GetPropertyValue("author") == null ? "" :item.GetPropertyValue("author").ToString() ) on @(item.GetPropertyValue("postedDate") == null ? "" :item.GetPropertyValue("postedDate").ToString() ) </span>
                                </div>
                           </article>
                    </div>
                 </div> 
    

    And, even better, I can simply copy and paste the template code for each blog page:

    <article>
                <header>
                        <h3 class="normal-heading-light">@Umbraco.Field("title")</h3>
                        <div class="posted-by">Posted By @Umbraco.Field("author") on @Umbraco.Field("postedDate")</div>
                </header>
                <div class="large-6 columns">
    
    
                    @Umbraco.Field("opening")
    
                </div>
                <div class="large-6 columns">
                    <img src="@Umbraco.Field("blogImage")" alt="" class="align-center">
                </div>
                <div class="small-12 columns">
                   @Umbraco.Field("middle")
    
                   @Umbraco.Field("conclusion")
                </div>
    
            </article>
    

    And just update the contact from the front-facing CMS! Happy times :)

    Thanks for all your help, let me know if this is the solution you would've chosen.

    Alexis

  • Dennis Adolfi 1082 posts 6450 karma points MVP 6x c-trib
    May 06, 2016 @ 11:34
    Dennis Adolfi
    0

    Looks awesome Alexis!! Sometimes its just best to start over from scratch. :) And in your case it defenetly felt like the correct decision. I would probobly go for this aswell, saving time in the long run.

    Thank you for sharing all this code with the community, maybe it can help someone else in the future.

    Have a great day! :)

  • 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