Copied to clipboard

Flag this post as spam?

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


  • AvihayBit 149 posts 303 karma points
    Jan 16, 2017 @ 19:25
    AvihayBit
    0

    Weird URL handling while building a results page with dynamic list

    Hi, weird error while trying to create a simple search result page:

    var filteredQAs = rootNode.Descendants("KBQAItem").Where("author.Contains(@0)", "יעקב אריאל");
    filteredQAs = filteredQAs.Where("title.Contains(@0) || text.Contains(@0) || imgText.Contains(@0) || question.Contains(@0) || Author.Contains(@0)", searchString); 
    
    ...
    
    @foreach (var qa in filteredQAs.OrderBy("updateDate desc").Skip(currentPageNo * NumberOfItemsPerPage).Take(NumberOfItemsPerPage))
        {
            <div class="kbRow">
                <a href="@qa.Url" title="@qa.title">
                    <h3>@qa.title</h3>
                </a>
                <div class="author">@qa.author</div>
                @Html.Raw(Umbraco.Truncate(Umbraco.StripHtml(qa.question), 300, true))
            </div>
        }
    ...
    

    some of the links created just fine with nice URL, but some of them gets a #err-18040 (= this node Id...) href and I have no Idea why...

    If I try to just use @Umbraco.Content(18040 ).Url instead of @qa.Url it works fine, but @Umbraco.Content(qa.Id).Url doesnt... Where do this "#err- ..." comes from?!?!

    Its a big website (>20K nodes) started from umbraco 4 and upgraded every few monthes all the way to the current umbraco 7.5.2. There is also a standard URL ReWriting to add an www and the 's' https, but nothing special...

    Any Idea?

  • Alex Skrypnyk 6175 posts 24186 karma points MVP 8x admin c-trib
    Jan 23, 2017 @ 23:02
    Alex Skrypnyk
    0

    Hi AvihayBit

    I will not recommend to use dynamics for such operations.

    Try to use strongly typed models - you will have more clear errors in any case.

    Thanks,

    Alex

  • AvihayBit 149 posts 303 karma points
    Jan 25, 2017 @ 17:29
    AvihayBit
    0

    Hi Alex,

    Thanks for trying, but I tried @Umbraco.TypedContent(qa.Id).Url and it didn't helped either...

    Anyone frome the core team cant say what couse for this URL generating error?

Please Sign in or register to post replies

Write your reply to:

Draft