Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Category URLs for Older Das Blog Migration #689

Open
thousandtyone opened this issue Sep 2, 2023 · 1 comment
Open

Category URLs for Older Das Blog Migration #689

thousandtyone opened this issue Sep 2, 2023 · 1 comment
Assignees

Comments

@thousandtyone
Copy link
Contributor

thousandtyone commented Sep 2, 2023

Older das blog supported Category URLs without spaces e.g.:

https://www.thousandtyone.com/blog/CategoryView,category,LifeHackingAndGettingThingsDone.aspx
(is a real category URL that my blog running on older das blog has).

These URLs are getting broken when migrated to the new DasBlog because the new DasBlog only supports:
https://localhost:5001/category/life-hacking-and-getting-things-done

I've personalized this locally on my instance (Described below) to support both new and older URLs for categories but would it be possible to have Dasblog Support the older format so that category URLs that may have been crawled by Google are reatined?

I think all older users may be impacted by this. If enough older users are impacted by this issue can we support this older category URL format in the new Das Blog for people who are migrating their older blogs?

If we don't end up supporting this because sufficient users are not impacted by this, no worries, I'll just have to live with customizations on my instance.

Here are the customizations I've done locally to support my older URLs (lined marked with //Personal-Customization):

		[HttpGet("category/{cat}")]
		//Personal-Customization: To support older category Routes
		[HttpGet("CategoryView,category,{cat}.aspx")]
		public IActionResult Category(string cat)
		{
			//Personal-Customization: To Convert CamelCase to Space Separated as needed by DasBlog.
			if(!cat.Contains(" "))
			{
				cat= Regex.Replace(cat, "(\\B[A-Z])", " $1");
			}
			//Personal-Customization ends here.

			var stopWatch = new Stopwatch();
			stopWatch.Start();

			var viewModel = GetCategoryListFromCategoryManager(cat.ToLower());

			stopWatch.Stop();
			logger.LogInformation(new EventDataItem(EventCodes.Site, null, $"CategoryController.Category ({cat}) Time elapsed: {stopWatch.Elapsed.TotalMilliseconds}ms"));

			return View(viewModel);
		}

My customization is a quick hack at best. It also has an issue in that it makes the category URLs case-sensitive. The best option would be to remove the + as a space separator when forming a category map in the cache.

I can look for a cleaner way of supporting old URLs in categories and supporting the older pattern elegantly based on a site config value. I am happy to look into this and provide a proper PR (instead of the above-customized hack) if others believe this is a big enough issue to be fixed (since this only affects category pages of older users like me who have these category pages indexed in google for some reason with high page rank).

If someone else has an easier more elegant fix please feel free to suggest!

Do we feel this is an issue that is big enough to be fixed? Happy to look into this and provide a PR if no quick fixes exist and if others will benefit from it.

@poppastring
Copy link
Owner

@thousandtyone I like the idea of no url being left behind, I just did not prioritize category pages. Additionally it will not impact anyone who is new to dasblog.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants