Ejemplo n.º 1
0
        protected virtual string GetCanonicalUrl(GetPageHeaderParam param, ProductViewModel product)
        {
            var relativeUri = ProductUrlProvider.GetProductUrl(new GetProductUrlParam
            {
                CultureInfo = param.CultureInfo,
                ProductId   = param.ProductId,
                ProductName = product.DisplayName,
                SKU         = product.Sku
            });

            if (HttpContext.Current == null)
            {
                Log.Error("HttpContext.Current is null");

                return(relativeUri);
            }

            try
            {
                var baseUri = RequestUtils.GetBaseUrl(HttpContext.Current.Request.Url);

                var url = new Uri(baseUri, relativeUri);

                return(url.ToString());
            }
            catch (Exception ex)
            {
                string fullStackTrace = ex.StackTrace + Environment.StackTrace;
                Log.Error($"Error retrieving product canonical url. Exception : {ex}, {fullStackTrace}");

                return(relativeUri);
            }
        }
Ejemplo n.º 2
0
        public virtual async Task <PageHeaderViewModel> GetPageHeaderViewModelAsync(GetPageHeaderParam param)
        {
            if (param == null)
            {
                throw new ArgumentNullException(nameof(param));
            }

            return(await SearchViewService.GetPageHeaderViewModelAsync(param).ConfigureAwait(false));
        }
        protected virtual string GetPageTitle(GetPageHeaderParam param)
        {
            var templateTitle = LocalizationProvider.GetLocalizedString(new GetLocalizedParam
            {
                Category    = "List-Search",
                Key         = "L_SearchResultsForBreadcrumb",
                CultureInfo = ComposerContext.CultureInfo
            });

            var pageTitle = templateTitle + " \"" + param.Keywords + "\"";

            return(pageTitle);
        }
        public virtual Task <PageHeaderViewModel> GetPageHeaderViewModelAsync(GetPageHeaderParam param)
        {
            if (param == null)
            {
                throw new ArgumentNullException(nameof(param));
            }

            var pageHeaderViewModel = new PageHeaderViewModel
            {
                PageTitle = GetPageTitle(param),
                NoIndex   = !IsPageIndexed(param)
            };

            return(Task.FromResult(pageHeaderViewModel));
        }
 protected virtual bool IsPageIndexed(GetPageHeaderParam param)
 {
     return(param.IsPageIndexed);
 }