Esempio n. 1
0
        public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output)
        {
            var items = _breadCrumbManager.BuildMenu(ViewContext);


            var content = await output.GetChildContentAsync();

            output.TagName = "title";
            output.TagMode = TagMode.StartTagAndEndTag;

            var title = _pageTitleBuilder.GenerateTitle(new HtmlString(this.Separator));

            if (!Equals(title, HtmlString.Empty))
            {
                if (!content.IsEmptyOrWhiteSpace)
                {
                    output.PostContent.AppendHtml(new HtmlString(Separator));
                }
                output.PostContent.AppendHtml(title);

                // Add generated page title to context for general access
                ViewContext.HttpContext.Items[typeof(PageTitle)] = new PageTitle()
                {
                    Title = title.ToHtmlString().ToString()
                };
            }
        }
Esempio n. 2
0
        public override Task ProcessAsync(TagHelperContext context, TagHelperOutput output)
        {
            output.TagName = "ol";
            output.TagMode = TagMode.StartTagAndEndTag;

            var items = _breadCrumbManager
                        .BuildMenu(_actionContextAccessor.ActionContext);

            if (items != null)
            {
                output.PreContent.SetHtmlContent(BuildBreadCrumb(items));
            }

            return(Task.CompletedTask);
        }