/// <summary> /// Creates the blog URL from the given blog title. /// </summary> /// <param name="title">The title.</param> /// <param name="unsavedUrls">The unsaved urls.</param> /// <param name="categoryId">The category identifier.</param> /// <returns> /// Created blog URL /// </returns> public string CreateBlogPermalink(string title, List <string> unsavedUrls = null, Guid?categoryId = null) { string newUrl = null; if (UrlHelper.GeneratePageUrl != null) { try { newUrl = UrlHelper.GeneratePageUrl( new PageUrlGenerationRequest { Title = title, CategoryId = categoryId }); } catch (Exception ex) { Logger.Error("Custom blog post url generation failed.", ex); } } if (string.IsNullOrWhiteSpace(newUrl)) { newUrl = CreateBlogPermalinkDefault(title, unsavedUrls); } else { newUrl = urlService.AddPageUrlPostfix(newUrl, "{0}"); } return(newUrl); }
/// <summary> /// Creates the page permalink. /// </summary> /// <param name="url">The URL.</param> /// <param name="parentPageUrl">The parent page URL.</param> /// <returns> /// Created permalink /// </returns> public string CreatePagePermalink(string url, string parentPageUrl, Guid?parentPageId = null, Guid?languageId = null, Guid?categoryId = null) { string newUrl = null; if (UrlHelper.GeneratePageUrl != null) { try { newUrl = UrlHelper.GeneratePageUrl( new PageUrlGenerationRequest { Title = url, ParentPageId = parentPageId, LanguageId = languageId, CategoryId = categoryId }); } catch (Exception ex) { Logger.Error("Custom page url generation failed.", ex); } } if (string.IsNullOrWhiteSpace(newUrl)) { newUrl = CreatePagePermalinkDefault(url, parentPageUrl); } else { newUrl = urlService.AddPageUrlPostfix(newUrl, "{0}"); } return(newUrl); }
/// <summary> /// Creates the blog URL from the given blog title. /// </summary> /// <param name="title">The title.</param> /// <returns>Created blog URL</returns> public string CreateBlogPermalink(string title) { var url = title.Transliterate(); url = urlService.AddPageUrlPostfix(url, configuration.ArticleUrlPattern); return(url); }
/// <summary> /// Creates the blog URL from the given blog title. /// </summary> /// <param name="title">The title.</param> /// <param name="unsavedUrls">The unsaved urls.</param> /// <returns> /// Created blog URL /// </returns> public string CreateBlogPermalink(string title, List <string> unsavedUrls = null) { var url = title.Transliterate(true); url = urlService.AddPageUrlPostfix(url, configuration.ArticleUrlPattern, unsavedUrls); return(url); }
/// <summary> /// Creates the page permalink. /// </summary> /// <param name="url">The URL.</param> /// <param name="parentPageUrl">The parent page URL.</param> /// <returns> /// Created permalink /// </returns> public string CreatePagePermalink(string url, string parentPageUrl) { var prefixPattern = string.IsNullOrWhiteSpace(parentPageUrl) ? "{0}" : string.Concat(parentPageUrl.Trim('/'), "/{0}"); url = url.Transliterate(); url = urlService.AddPageUrlPostfix(url, prefixPattern); return(url); }