private Uri MakePermaLinkFromCompressedTitle(Entry entry) { if (Pass(() => dasBlogSettings.SiteConfiguration.EnableTitlePermaLinkUnique, () => opts.EnableTitlePermaLinkUnique)) { return(Pass(() => new Uri(new Uri(dasBlogSettings.SiteConfiguration.Root) , dasBlogSettings.RelativeToRoot( entry.CreatedUtc.ToString("yyyyMMdd") + "/" + dasBlogSettings.GetPermaTitle(entry.CompressedTitle))) , () => new Uri(new Uri(opts.Root) , SettingsUtils.RelativeToRoot( entry.CreatedUtc.ToString("yyyyMMdd") + "/" + SettingsUtils.GetPermaTitle(entry.CompressedTitle, opts.TitlePermalinkSpaceReplacement) , opts.Root)) )); } else { return(Pass( () => new Uri(new Uri(dasBlogSettings.SiteConfiguration.Root) , dasBlogSettings.RelativeToRoot( dasBlogSettings.GetPermaTitle(entry.CompressedTitle))) , () => new Uri(new Uri(opts.Root) , SettingsUtils.RelativeToRoot( SettingsUtils.GetPermaTitle(entry.CompressedTitle, opts.TitlePermalinkSpaceReplacement), opts.Root)) )); } }
/// <param name="dt">if non-null then the post must be dated on that date</param> public Entry GetBlogPost(string postid, DateTime?dt) { if (dt == null) { return(dataService.GetEntry(postid)); } else { var entries = dataService.GetEntriesForDay(dt.Value, null, null, 1, 10, null); return(entries.FirstOrDefault(e => SettingsUtils.GetPermaTitle(e.CompressedTitle, opts.TitlePermalinkSpaceReplacement) .Replace(opts.TitlePermalinkSpaceReplacement, string.Empty) == postid)); } }
private Uri MakePermaLinkFromCompressedTitle(Entry entry) { if (opts.EnableTitlePermaLinkUnique) { return (new Uri(new Uri(opts.Root), SettingsUtils.RelativeToRoot(entry.CreatedUtc.ToString("yyyyMMdd") + "/" + SettingsUtils.GetPermaTitle(entry.CompressedTitle, opts.TitlePermalinkSpaceReplacement), opts.Root)) ); } else { return (new Uri(new Uri(opts.Root), SettingsUtils.RelativeToRoot( SettingsUtils.GetPermaTitle(entry.CompressedTitle, opts.TitlePermalinkSpaceReplacement), opts.Root))); } }
/// <param name="dt">if non-null then the post must be dated on that date</param> public Entry GetBlogPost(string postid, DateTime?dt) { if (dt == null) { return(dataService.GetEntry(postid)); } else { EntryCollection entries = dataService.GetEntriesForDay(dt.Value, null, null, 1, 10, null); return(entries.FirstOrDefault(e => Pass(() => dasBlogSettings.GetPermaTitle(e.CompressedTitle), () => SettingsUtils.GetPermaTitle(e.CompressedTitle, opts.TitlePermalinkSpaceReplacement)) .Replace(Pass(() => dasBlogSettings.SiteConfiguration.TitlePermalinkSpaceReplacement, () => opts.TitlePermalinkSpaceReplacement), string.Empty) == postid)); } }