Blog Post Custom URLs
I found this article (custom_url_formats_for_sitefinity_content_modules) on specifying a custom URL format for news and blog posts. However, after following the instructions, everything appears to be working except the URLs are unchanged. I have the custom blog provider and a blog posts widget which displays the blogs created under that provider.
Here is the code I'm using (which is the same as from the article):
public
class
BlogProviderNoDateUrls : OpenAccessBlogProvider
/// <summary>
/// The URL format string for blog items
/// </summary>
public
string
BlogUrlFormat
get
;
set
;
/// <summary>
/// The URL format string for blog post items
/// </summary>
public
string
BlogPostUrlFormat
get
;
set
;
public
override
string
GetUrlFormat(Telerik.Sitefinity.GenericContent.Model.ILocatable item)
if
(item.GetType() ==
typeof
(Blog))
return
this
.BlogUrlFormat;
else
if
(item.GetType() ==
typeof
(BlogPost))
return
this
.BlogPostUrlFormat;
else
return
base
.GetUrlFormat(item);
protected
override
void
Initialize(
string
providerName, System.Collections.Specialized.NameValueCollection config, Type managerType)
base
.Initialize(providerName, config, managerType);
this
.BlogUrlFormat = config[
"blogUrlFormat"
];
if
(String.IsNullOrEmpty(
this
.BlogUrlFormat))
this
.BlogUrlFormat =
"/[UrlName]"
;
this
.BlogPostUrlFormat = config[
"blogPostUrlFormat"
];
if
(String.IsNullOrEmpty(
this
.BlogPostUrlFormat))
this
.BlogPostUrlFormat =
"/[Parent.UrlName]/[PublicationDate, 0:yyyy'/'MM'/'dd]/[UrlName]"
;
Hello Jeff,
Thank you for contacting us.
I have inspected the code sample and everything looks good. I have to try this solution on my test project and see if it is work for version 6.1. I will update you with information as soon as I have a result.
Thank you for your patience.
Regards,
Kaloyan
Telerik
Thanks.
Note that I am using Sitefinity 5.1.3450.0 for this web site.
Hi all,
I followed the steps. The thing is when we preview the draft or unpublished blog it throws a 404.
The Sitefinity URL query rules for preview no longer show. Is there a fix for this?
I followed the steps. The thing is when we preview the draft or unpublished blog it throws a 404.
The Sitefinity URL query rules for preview no longer show. Is there a fix for this?