Copied to clipboard

Flag this post as spam?

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


  • Roland Tindall 6 posts 76 karma points
    Dec 28, 2018 @ 23:10
    Roland Tindall
    0

    Pages Under Home Load Twice

    The page/templates under the home node call webbase twice. I figure that it is taking twice as long to load the pages. Version 7.2

    Webbase.cshtml @inherits Umbraco.Web.Mvc.UmbracoTemplatePage @{ Layout = null; }

    @{Html.RenderPartial("SiteLayout/MetaData");}

    @{Html.RenderPartial("SiteLayout/MainNavigation");} @RenderBody(); @{Html.RenderPartial("SiteLayout/_Footer");} @{string stop = "here";}

    <!-- Scripts -->
    <script src="/Scripts/jquery.min.js"></script>
    <script src="/scripts/jquery.validate.min.js"></script>
    <script src="/scripts/jquery.validate.unobtrusive.min.js"></script>
    <script src="/Scripts/jquery.dropotron.min.js"></script>
    <script src="/Scripts/jquery.scrolly.min.js"></script>
    <script src="/Scripts/jquery.scrollex.min.js"></script>
    <script src="/Scripts/browser.min.js"></script>
    <script src="/Scripts/breakpoints.min.js"></script>
    <script src="/Scripts/util.js"></script>
    <script src="/Scripts/main.js"></script>
    <script src="/scripts/jquery.unobtrusive-ajax.js"></script>
    <script src="/Scripts/ContactForm.js"></script>
    

    Template for List page @inherits Umbraco.Web.Mvc.UmbracoTemplatePage @{ Layout = "WebBase.cshtml"; }

    @{Html.RenderAction("RenderArticles", "Article", new { itemsToShow = 10 });} @{string stop = "here";}

    ArticalController.cs public class ArticleController:SurfaceController {

        public string GetViewPath(string name)
        {
            return $"/Views/Partials/Content/{name}.cshtml";
        }
    
        public ActionResult RenderArticles(int itemsToShow)
        {
            ArticleList model = new ArticleList();
            model.IsHomePage = false;
    
            IPublishedContent Page = CurrentPage;
            List<Article> slItems = null;
            slItems = new List<Article>();
    
            List<IPublishedContent> articles = Page.Children.Take(3).OrderBy(x => x.GetPropertyValue<int>("priority")).ToList();
            if (articles != null)
            {
                slItems.AddRange(articles.Select(x => IPublishedContentExtensions.ToSpotLightItem(x)).ToList());
                model.Items = itemsToShow > 0 ? slItems.Take(itemsToShow).OrderBy(x => x.Priority).ToList() : slItems;
                return PartialView(GetViewPath("_Articles"), model);
            }
            else
            {
                return null;
            }
        }
    }
    
  • Roland Tindall 6 posts 76 karma points
    Dec 29, 2018 @ 00:44
    Roland Tindall
    0

    OK, I've narrowed it down.

    Any page other than the site root page calls a respective template twice. Does not matter if you call/utilize the webbase or not.

  • Roland Tindall 6 posts 76 karma points
    Dec 29, 2018 @ 00:45
    Roland Tindall
    0

    I'm running in Visual Studio 2017 in debug mode with break within respective areas.

  • Marcio Goularte 388 posts 1360 karma points
    Dec 29, 2018 @ 13:07
    Marcio Goularte
    0

    Roland,

    Are you using Google Chrome? When this happens you type the url?

    If so, this is a browser feature, and in debug mode, your breakpoint stops a first request from the browser and the second that is your call. I do not know why Chrome has this behavior, but it happens

  • Roland Tindall 6 posts 76 karma points
    Dec 29, 2018 @ 14:53
    Roland Tindall
    0

    Marcio,

    Using chrome. Happens whether I type url or not. So its just a debug issue. Thanks for response.

  • Marcio Goularte 388 posts 1360 karma points
    Dec 29, 2018 @ 15:08
    Marcio Goularte
    0

    Yea. When you start typing the url, Chrome does the autocomplete. It requests from autocomplete before you finish typing.

Please Sign in or register to post replies

Write your reply to:

Draft