GBC Posted June 13 Posted June 13 I've created multiple product Categories and notice that when someone goes to the store page, the "All" (or whatever it's been renamed to) shows all products in all categories. I would like to hide/remove the All display and start by showing just the items in the top/first category. Is there a setting for that or some custom code to make that work?
Lesum Posted June 13 Posted June 13 @GBC Can you share your site URL? If my comments were useful, please like or mark my solution as answer so others can scroll to it quickly. Sam Web Developer & Digital Designer ☕ Did you find my contribution helpful? Buy me a coffee?
GBC Posted June 13 Author Posted June 13 This is just a test/demo page... I haven't populated it with multiple products in each category yet (as I want to see if I can get this to work), but by default when going to the page, all the products are shown. In this case, I'd want a user to go to this page and only see the top category items (March), then click on other months to see the items in those categories.
Lesum Posted June 13 Posted June 13 @GBC Which page is the shop page? I'm not seeing any 'All' category on the page you shared If my comments were useful, please like or mark my solution as answer so others can scroll to it quickly. Sam Web Developer & Digital Designer ☕ Did you find my contribution helpful? Buy me a coffee?
GBC Posted June 13 Author Posted June 13 I had renamed it to "Months" but then in the Store Settings - General under "TOP CATEGORY NAME" I had disabled the filter so that wasn't visible - I've turned that back on. With it on or off, when going to the page all products are shown....
Lesum Posted June 13 Posted June 13 @GBC You can add this code under Custom CSS panel: .products .nested-category-tree-wrapper li.category-item:first-child { display: none !important; } If my comments were useful, please like or mark my solution as answer so others can scroll to it quickly. Sam Web Developer & Digital Designer ☕ Did you find my contribution helpful? Buy me a coffee?
GBC Posted June 13 Author Posted June 13 Hmm - added that CSS but March actually disappeared, and all products are still displayed on the page
Lesum Posted June 14 Posted June 14 @GBC I'm not entirely sure what you meant in your last comment. Are you saying that you want to remove the 'All' category from the product page? If so, the code I provided should have achieved that. If my comments were useful, please like or mark my solution as answer so others can scroll to it quickly. Sam Web Developer & Digital Designer ☕ Did you find my contribution helpful? Buy me a coffee?
GBC Posted June 14 Author Posted June 14 That's only part of what's needed. " by default when going to the page, all the products are shown. In this case, I'd want a user to go to this page and only see the top category items (in this case, March), then click on other months to see the items in those categories.
Solution creedon Posted June 15 Solution Posted June 15 (edited) What you describe is not an unusual design pattern for the most part but Squarespace doesn't support what you describe natively. A unique element of your request is to automatically have the first category become the "main" page for the store page. Although it is possible to determine the first category of the store page with JavaScript. The time it takes is too long in my testing to be practical. So I think you are left with some JavaScript that would redirect to a category page you set manually. The first trick is to never link directly to your /booking URL Slug. Second you will want to redirect site visitors to another URL if they do make their way to your main (all category) store page. Please see SPLACR Date Progression Redirect. In my code you'd want to replace... '[ enter url here replacing square brackets ]' : '[ enter date here replacing square brackets ]', ...with something like the following... '/booking/march-2025' : '2025-03-01', '/booking/april-2025' : '2025-04-01', '/booking/may-2025' : '2025-05-01', '/booking/june-2025' : '2025-06-01', '/booking/july-2025' : '2025-07-01', '/booking/august-2025' : '2025-08-01', '/booking/september-2025' : '2025-09-01', '/booking/october-2025' : '2025-10-01', '/booking/november-2025' : '2025-11-01', You would of course need to maintain the urlDateMap manually. Let me know how it goes. Edited June 16 by creedon Find my contributions useful? Please like, upvote, mark my answer as the best ( solution ), and see my profile. Thanks for your support! I am a Squarespace ( and other technological things ) consultant open for new projects.
GBC Posted June 16 Author Posted June 16 Thank you! It occurred to me that the simple solution is to just link to the first category. The suggestions regarding the redirects are very helpful. creedon 1
creedon Posted June 16 Posted June 16 (edited) On 6/16/2024 at 9:58 AM, GBC said: the simple solution is to just link to the first category. Some downsides to the link to category method and not using my redirect code is that it is possible for site visitors to get to the All category page. Search engines may index the All category page. To reduce the chance that it is, you'd need some JavaScript to add a robots noindex request to the All category page. Also depending on the settings, a link to the All category page may be presented in the UI. You may need to use CSS or JavaScript to make those links go away. Edited June 17 by creedon Find my contributions useful? Please like, upvote, mark my answer as the best ( solution ), and see my profile. Thanks for your support! I am a Squarespace ( and other technological things ) consultant open for new projects.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment