This project is read-only.

TagCloud and URL String

Dec 31, 2008 at 11:11 PM
I am seeing when I click on a tag from my TagCloud that has a space in it (IE: visual basic) that the URL String looks like ?tag=/visual+basic when really it is supposed to look like ?tag=/visual-basic.

Does anyone know where I can change this?  I do not want to download the latest version of BE because I have made a number of modifications that I now cannot remember what I changed.... I suppose I should go through and comment my changes....

well.... Thanks in advance.
Dec 31, 2008 at 11:30 PM
Edited Dec 31, 2008 at 11:32 PM
OK so I seem to have fixed it by changing this line in (~/App_Code/Controls/TagCloud.cs)... probably a hack, but it works.
writer.Write(string.Format(LINK, Utils.RelativeWebRoot + "?tag=/" + HttpUtility.UrlEncode(key), WeightedList[key], "Tag: " + key, key));

writer.Write(string.Format(LINK, Utils.RelativeWebRoot + "?tag=/" + HttpUtility.UrlEncode(key).Replace("+","-"), WeightedList[key], "Tag: " + key, key));
Jan 1, 2009 at 12:52 AM
Do you also list the tags at the bottom of each post?  If so, do you see - or + signs between the words there?  There's an open work issue to fix the -/+ problem in the tag list at the bottom of posts.  In the latest builds of BE, there is no problem with the -/+ issue in the Tag Cloud -- it's just the tags at the bottom of each post that have this problem.
Jan 1, 2009 at 3:30 AM
Yes I have the +/- issue in the bottom of the posts too.

I have upgraded bits and pieces of BE to the latest build but am leary of upgrading everything since I made so many modifications.  I will just have to fix it the same way as I did the other bit.
Jan 1, 2009 at 4:51 AM
Appears that changing the same thing in the PostViewBase.cs fixed the problem in the posts.

tags[i] = string.Format(CultureInfo.InvariantCulture, link, path, HttpUtility.UrlEncode(tag).Replace("+","-"), HttpUtility.HtmlEncode(tag));
Jan 1, 2009 at 11:50 PM
Yeah, I also should be more organized about keeping track of what changes I made to BE.  I recently installed Beyond Compare which is turning out to be a great tool to easily compare differences in files between two different folders.  I plan on using this for my next blog upgrade to help me remember which files I made changes too.

BTW, just FYI, the Tag Cloud widget in the most recent build of BE uses Utils.RemoveIllegalCharacters(tag) instead of HttpUtility.UrlEncode(tag).  RemoveIllegalCharacters replaces spaces with hyphens.  But Replace("+", "-") works too!