Missing Sitefinity Blog Default Page

When you create a blog in Sitefinity, you must also assign it a Default Page, which is the page that contains the BlogPosts widget for displaying the full Details View of a post.

If you delete this page, move the BlogPosts widget to another page, or modify this relationship in any other way, you must make sure to update the settings for your blog so that it always points to the correct page. Otherwise, Sitefinity will have no way of knowing where your blog posts are located.

This isn't necessarily a problem for your end users, because the BlogPosts widget takes care of both creating and handling the urls for your blog posts. So no links will be broken, and everything will work as expected for your readers.

However, any external applications will probably fail, because they have no way of knowing the urls to the blog posts, because they don't know what page on which they render.

One such example is the Sitefinity Sitemap Module SDK Sample I wrote. This module relies on the DefaultPage property to render the urls for the Sitemap.

Another big example is Windows Live Writer. As I wrote about on my personal blog, Live Writer is great for blogging with Sitefinity. Unfortunately, if the default page is missing for your bLog, WLW can't determine where to post your blog posts and fails.

The solution is simple: before you delete a page associated with a blog, make sure to first update your Blog settings to point to the new landing page.

However, if you've already deleted the page (like I did), and attempt to update the Blogs settings for default page, you might receive the following error:

You are trying to access item that no longer exists. The most probable reason is that it has been deleted by another user.

This is unfortunately the result of a bug, which the team is aware of and will be fixing. However until then, you can fix this programmatically by running the following code on your site, which assigns the first page it finds as the default page.

var pageId = Telerik.Sitefinity.App.WorkWith().Pages().LocatedIn(Telerik.Sitefinity.Fluent.Pages.PageLocation.Frontend).Get().First().Id;

Telerik.Sitefinity.App.WorkWith().Blogs().Where(b => b.Title == "[THE_BLOG_TITLE").First().Do(b => b.DefaultPageId = pageId).SaveChanges();

I did this by creating a simple Test.aspx page, adding the snippet in the Page_Load event in the code behind, building the project, then launching that page. Finally, I deleted the page after execution, and was able to go into the blog settings to assign the correct default page.

It works great, and I'm finally back on Live Writer, and in fact wrote this post using it, with hopefully many more to come, including a new video series all about Sitefinity... Stay tuned for more on that!

Enjoyed this post and/or found it useful?
Tagged with:
SelArom Dot Net Profile Image
SelAromDotNet

Josh loves all things Microsoft and Windows, and develops solutions for Web, Desktop and Mobile using the .NET Framework, Azure, UWP and everything else in the Microsoft Stack.

His other passion is music, and in his spare time Josh spins and produces electronic music under the name DJ SelArom.



Scroll to top