public async Task <IViewComponentResult> InvokeAsync() { string MetaTag = this.HttpContext?.Items[HttpContextKey.SEOMeta]?.ToString(); if (string.IsNullOrEmpty(MetaTag)) { SEOController seoController = new SEOController(); MetaTag = await seoController.GetSEOMetaValuesByPageName(PageName, SiteID); } ViewData["SEOMeta"] = MetaTag; return(View()); }
/// <summary> /// Add update page. /// </summary> /// <param name="objPage">Object of PageEntity class.</param> public int AddUpdatePages(PageEntity objPage) { int pageID = 0; try { PageDataProvider objProvider = new PageDataProvider(); pageID = objProvider.AddUpdatePages(objPage); //For SEO Meta Data if (objPage.PageID == 0 && objPage.IsAdmin == false) { List <SEOMetaValues> metaValues = new List <SEOMetaValues>(); SEOMetaValues title = new SEOMetaValues(); title.SEOMetaTagTypeID = 1; title.MetaTagContent = objPage.PageName; metaValues.Add(title); SEOMetaValues desc = new SEOMetaValues(); desc.SEOMetaTagTypeID = 2; desc.MetaTagContent = objPage.Description; metaValues.Add(desc); SEOMetaValues image = new SEOMetaValues(); image.SEOMetaTagTypeID = 4; image.MetaTagContent = string.Empty; metaValues.Add(image); SEOMetaValues type = new SEOMetaValues(); type.SEOMetaTagTypeID = 5; type.MetaTagContent = string.Empty; metaValues.Add(type); SEOController seoContrl = new SEOController(); seoContrl.SaveSEOMetaTag(pageID, metaValues, objPage.PortalID, objPage.AddedBy); } } catch (Exception e) { throw e; } return(pageID); }
/// <summary> /// Add update page. /// </summary> /// <param name="objPage">Object of PortalPage class.</param> public async Task <string> AddUpdatePages(PortalPage objPage, List <PageRolePermission> RolePermissions, string hostUrl, int siteID, string userName) { string pageID = string.Empty; PageDataProvider objProvider = new PageDataProvider(); pageID = await objProvider.AddUpdatePages(objPage, RolePermissions, siteID, userName); //For SEO Meta Data List <SEOMetaValues> metaValues = new List <SEOMetaValues>(); SEOMetaValues title = new SEOMetaValues(); title.SEOMetaTagTypeID = 1; //Type title.MetaTagContent = objPage.PageName; metaValues.Add(title); SEOMetaValues desc = new SEOMetaValues(); desc.SEOMetaTagTypeID = 2;//Title desc.MetaTagContent = objPage.Title; metaValues.Add(desc); SEOMetaValues image = new SEOMetaValues(); image.SEOMetaTagTypeID = 4;//Description image.MetaTagContent = string.Empty; metaValues.Add(image); SEOMetaValues type = new SEOMetaValues(); type.SEOMetaTagTypeID = 5;//Url type.MetaTagContent = string.Empty; metaValues.Add(type); SEOController seoContrl = new SEOController(); await seoContrl.SaveSEOMetaTag(pageID, metaValues, userName, hostUrl); return(pageID); }
public void BindSEOManageLayout() { StringBuilder pageHTML = new StringBuilder(); PageController pageController = new PageController(); List <PageEntity> pages = pageController.GetMenuFront(GetPortalID, false); pageHTML.Append("<div><select id='slcPages' name='slcPages'><option value='0'>Select a Page</option>"); foreach (PageEntity item in pages) { pageHTML.Append("<option value=\""); pageHTML.Append(item.PageID); pageHTML.Append("\">"); pageHTML.Append(item.PageName); pageHTML.Append("</option>"); } pageHTML.Append("</select></div>"); ltrPagenames.Text = pageHTML.ToString(); SEOController seoContrl = new SEOController(); List <SEOMetaType> lstMetaTag = seoContrl.GetSEOMetaType().Where(i => i.IsShownFront == true && i.IsSystem == false).ToList(); if (lstMetaTag.Count > 0) { StringBuilder layout = new StringBuilder(); StringBuilder savedData = new StringBuilder(); foreach (SEOMetaType item in lstMetaTag) { layout.Append("<div class='metaColection'>"); layout.Append("<div class='metaKey' >");//<span class='sfFormlabel'>"); //layout.Append(item.TypeName); //layout.Append("</span>"); layout.Append("<span class=''sfSelectLabel> Select "); layout.Append(item.TypeName); layout.Append("</span>"); layout.Append("</div>"); layout.Append("<div class='metaValue'>"); if (item.HtmlTag.Trim() == "img") { layout.Append("<img id='txt_"); layout.Append(item.TypeName); layout.Append("' src='"); layout.Append(GetHostURL()); layout.Append("/Modules/Admin/SEOManagement/images/no-image.jpg"); layout.Append("' class='txtTextBox' height='100px' width='100px' name='txt_"); layout.Append(item.TypeName); layout.Append("' data-id='"); layout.Append(item.TagTypeID); layout.Append("' data-tag='"); layout.Append(item.HtmlTag.Trim()); layout.Append("' />"); } else if (item.HtmlTag.Trim() == "text") { layout.Append(BuildWebType()); layout.Append("<textarea id='txt_"); layout.Append(item.TypeName); layout.Append("' class='txtTextBox textareaValidate' name='txt_"); layout.Append(item.TypeName); layout.Append("' data-id='"); layout.Append(item.TagTypeID); layout.Append("' data-tag='"); layout.Append(item.HtmlTag.Trim()); layout.Append("'></textarea>"); } else { layout.Append("<textarea id='txt_"); layout.Append(item.TypeName); layout.Append("' class='txtTextBox textareaValidate' name='txt_"); layout.Append(item.TypeName); layout.Append("' data-id='"); layout.Append(item.TagTypeID); layout.Append("' data-tag='"); layout.Append(item.HtmlTag.Trim()); layout.Append("'></textarea>"); } layout.Append("</div>"); layout.Append("<div class='htmlParseValue'>"); layout.Append("</div>"); layout.Append("</div>"); savedData.Append("<li data-tagid='" + item.TagTypeID + "'>"); savedData.Append("<span class='tagName icon-circle-check'>"); savedData.Append(item.TypeName); savedData.Append("</span>"); savedData.Append("<span class='tagData'>"); savedData.Append("</span>"); savedData.Append("</li>"); } ltrTags.Text = layout.ToString(); ltrStoredSEO.Text = savedData.ToString(); } }