-
Notifications
You must be signed in to change notification settings - Fork 0
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
Parameterize Category labels in paths instead of escaping them #2
Comments
My thought is to approach this one of two ways:
The first seems easiest to maintain, but may not be particularly performant on sites with lots of categories. The latter would be far more performant, but I'm a little wary of adding & maintaining additional columns for models in ComfortableMexicanSofa. Either way, I should make this optional via a config option to ease transitions for anyone relying on the current implementation (esp. since ComfyBlog seems to have the same issue). I should also add some helper methods for generating the appropriate year/month & category archive links to simplify the views a bit. |
…chive::IndexController to use either current escaped Comfy::Cms::Category labels or new parameterized Category labels, plus tests. Now also results in a 404 page if the Category doesn't exist. Issue #2
…rchive_link_to_category' methods, the later automatically generating the appropriately encoded category label, plus tests. Issue #2
I went with the simpler implementation and we can optimize later, as necessary. I have also added a new |
… of 404 pages if Comfy::Cms::Category doesn't exist is optional, plus tests. Issue #2
My implementation also added other new functionality, specifically that the 404 error page is returned (or an exception thrown) if a matching |
All tests pass and this is working well in our internal testing. |
In the initial implementation of
Comfy::Archive::IndexController#index
I was lazy and just usedCGI::unescape
so that it was an easy#for_category
query. The view just does aCGI::escape
on theComfy::Cms::Category#label
(fromComfy::Archive::Index#categories
) to encode them, but that results in paths like/blog/category/In+the+News
. The labels should really be encoded withString#parameterize
to be consistent with how Rails & ComfortableMexicanSofa build paths & URLs.The text was updated successfully, but these errors were encountered: