Copied to clipboard

Flag this post as spam?

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


  • David 29 posts 200 karma points
    Mar 21, 2019 @ 16:30
    David
    0

    Related Links within Nested Content

    Could anyone help with the following:

    I have a "Nested Content" component which has "Min Items & Max Items" set to 3, I then have a "Related Links" component within that which has max items set to 1. However when i go to add that one link, I do not see the add option. (see below)

    enter image description here

    If i amend my "Related Links" to be max items 3, i see the option to add a link. If so do this, it would allow three items to be created per item in the nested content am i right? I would like the ability for only one item to be created per item in the nested content. Is there something I am doing wrong?

    On another note, rendering I am not sure on how I will go about rendering the related links in the view.

    This is what I have so far:

                        @{
    
                        var items = Model.Content.GetPropertyValue<IEnumerable<IPublishedContent>>("whyChooseSummit");
    
                        foreach (var reason in items)
                        {
                            <div class="feature">
                                <img src="/Content/images/logo-bullet-white.png" alt="Summit Law LLP" />
                                <div class="reason">
                                    <h4 class="blue-text">
                                        @*@reason.GetPropertyValue<RelatedLinks>("reasonTitle")>*@
                                    </h4>
                                    <p>@reason.GetPropertyValue("reason")</p>
                                </div>
                            </div>
                        }
    
                    }
    

    The "reasonTitle" property is the related links. Does anything know what I need to put to only pull through that one related link per nested content item?

  • Johannes Lantz 156 posts 839 karma points c-trib
    Apr 08, 2019 @ 18:01
    Johannes Lantz
    0

    Hi David,

    I am not to sure about the first one, I am just thinking out loud now. Do you maybe get an error in the console? Maybe try switching position so that the related link is in the bottom, have you tired creating it outside the nested content? Maybe try to recreate it as a data type?

    As for your code, by adding @using Umbraco.Web.Models to the top of the view should make the code work.

    Here is the documentation for Related Links

    https://our.umbraco.com/Documentation/Getting-Started/Backoffice/Property-Editors/Built-in-Property-Editors/Related-Links2

    //Johannes

Please Sign in or register to post replies

Write your reply to:

Draft