Help Changing Post Directory and Slug to Lower

Topics: ASP.NET 2.0, Controls, Themes
Mar 30, 2009 at 10:30 PM

I searched through the threads but really couldnt find any info on the following

My 1st task is wanting to change the post directory name from  say  to  mydomain/sparky/Cool-Blue-Widget.aspx

I found it hard coded in post.cs 



Utils.RelativeWebRoot + "post/" + DateCreated.ToString("yyyy/MM/dd/", CultureInfo.InvariantCulture) + slug;



return Utils.RelativeWebRoot + "post/" + slug;


and also changed it in urlrewrite.cs

else if (url.Contains("/post/"))

I then recompiled and uploaded, but I just get 404 error :(

can anyone show me what I may be missing?

Then my 2nd Task is to get the slug to be lower case,  so this




this is me being lazy when creating posts and after clicking title not having to manually change every 1st character of the tilte to lower case.

any advice will be a help


Mar 30, 2009 at 11:05 PM
For making the slug lower-case, I would do this in the Add_entry.aspx.cs page.  There's two places to modify -- one is most important, the other isn't as important.

In btnSave_Click, the slug is automatically set when post.Title is set -- and it is set again a little lower if there's a value in txtSlug.  You probably don't want to force your Title to be all lowercase.  I would change it to all lowercase after the slug is optionally set from the slug textbox (bolded part is new).

if (!string.IsNullOrEmpty(txtSlug.Text))
    post.Slug = Server.UrlDecode(txtSlug.Text.Trim());

post.Slug = post.Slug.ToLower();

The other optional place to lower case it would be when the 'Extract from title' link is clicked.  An async callback is done.  In Add_entry.aspx.cs, the line to change would be (bolded part is new):

_Callback = Utils.RemoveIllegalCharacters(eventArgument.Trim()).ToLower();
Mar 30, 2009 at 11:16 PM
Thanks Ben

You are top man when it comes to this blogs code.

are you available for hire, when it comes to making some blog adjustments or custom widgets?

please contact me via my profile, if you don't want to answer that in public,

Mar 30, 2009 at 11:26 PM
Thanks for the kind words :)  I just sent a message to you ...
Mar 30, 2009 at 11:45 PM
Thanks, I got the message and will be in touch soon.