In some instances, Search results display items that lead to a blank page because there is no template that can be accessed and styled. One such item is a product that has /sku/ in the url.
The url would look like this: your-comain.com/sku/product-name.
Using Javascript these search result items could be hidden from the page.
I have given the search results item an ID=“result” and the link block ID=“url”. Not sure if this was needed but in case it is, thia is what it is. Now I would need a script that will scan the search results list item “url” for “sku” and if TRUE then apply to the “result” a style display “none”.
I hope this makes sense.
Can someone please help?
By the way, this is a common problem with search results on Webflow that uses products. I have found others asking for help but no solution has been provided yet.
Thank you for your reply. I have modified my post to make it more clear.
Yes, I have watched this video and read the entire page several times. I have already set all the exclusions, pages and specific items, that were possible to exclude. However, this is Not possible to manage within the existing settings.
This is a specific issue I discovered while testing search. These /sku/ items only appear when I search for “viva” or “saloni”, both of which are a part of the title tag of most pages since it is the name of the website.
Please note that the URL fragment after the domain name indicates the page on which the item is located. /product/ or /category/. This means that there should be a page with the name /sku/ but there isn’t. At least it is not visible to us. Yet it lists the products which then appear in the search results. Strange.
I just thought of a different approach. I will not see the result until the site is re indexed tomorrow. However, this is the idea, but I think this only effects external search engines and the items will continue to show on the page search:
One is, you could use my WFU filtering library. It lets you do advanced element filtering using an expression or function, and it’s quite easy to drop in. You’d write one function ( e.g. filterFunc() to decide whether an element displays or not, and then you’d add a custom attribute to the Search Results Item element of wfu-filter-func = filterFunc.
Here are the docs, and the CSS & JS urls you’d add in too.
But there’s an option 2 for you. I think the pattern of the elements you’re trying to hide is so consistent that you might be able to just hide them with a CSS selector like this;
This is untested, as I don’t currently have any client ecom sites published on Webflow.
Let me know if it works.
NOTE: Because of the red syntax highlighting above, you may be tempted to think that /sku/ is something you’re supposed to replace… avoid that temptation. It’s matching an important path part to find those rogue SKU results, so leave it exactly as above.
Thank you very much for the effort. I tried the second one because I fully understood it, and it worked perfectly. The first method I will study a bit when I have more time because it is valuable to know.
Thank you again!
I will share this in the post that asked the same question but has never received an answer.
It looks like you’re trying to do something quite different from the original rogue-SKU bug we were solving. I’m a bit curious why you’re wanting to exclude arbitrary ( but otherwise legit ) matches from your search results.
But, the same CSS approach should work for you, and so would the dynamic filter.
Here though, your URLs start differently;
They begin with /product/addon- so you need that in your CSS match, i.e. href^="/product/addon-".
I’m using CSS’s starts-with ( ^= ) attribute selector, for precision, so if you’re using that you need to match from the beginning of the URL. There are alternative selectors too.
Thanks again for assisting. Webflow support led me here, stating this was the go-to thread for people facing issues due to Webflows limitation of not being able to exclude specific CMS items from search results.
On our store, we have two types of products,
Regular products, that our clients can buy.
Add on based products, which are a bit more secondary to our regular products.
Now, this creates an issue on our search engine, as it’s a bit out of context for our users and makes little sense to find the add-on-based products without their associated product parents.
I wasn’t able to make the CSS method work, but i succeeded on hiding them with the following JavaScript:
Thank Kasper that makes sense. Incidentally, the CSS approach should work for you, and would have the bonus that those items will never be visible. with the jquery approach they’ll appear briefly until the script runs at the end of the page load.