dchavez Posted September 17, 2020 Share Posted September 17, 2020 (edited) Site URL: https://www.gypset.com/ Hi, I made my site searchable but I want to hide a blog page with lots of posts that are used to feed information to some pop ups on a map www.gypset.com/atlas since the information is on the excerpts when you type a location on the search bar the blog post appears empty. I would like to find a way to just hide those from the search functionality on the site. I know it can be done with css but not sure how to. Hope I make sense! Edited September 17, 2020 by danielachavez Link to comment
creedon Posted September 17, 2020 Share Posted September 17, 2020 Go to Blog Settings > SEO and at the bottom of the dialog there are three options for hiding information from search engines? Is that what you are looking for? Let us know how it goes. Find my contributions useful? Please like, upvote, mark my answer as best , and see my profile. Thanks for your support! Link to comment
dchavez Posted September 17, 2020 Author Share Posted September 17, 2020 13 hours ago, creedon said: Go to Blog Settings > SEO and at the bottom of the dialog there are three options for hiding information from search engines? Is that what you are looking for? Let us know how it goes. Hi, Thank for this but, I want to hide the pages from the search results within the website itself. (I already hid the pages from search results on seo) Do you know any way to do it? @creedon Link to comment
creedon Posted September 18, 2020 Share Posted September 18, 2020 Ah. Can you give us a search phrase we can use to test on your site to see the issue you are seeing? Find my contributions useful? Please like, upvote, mark my answer as best , and see my profile. Thanks for your support! Link to comment
dchavez Posted September 23, 2020 Author Share Posted September 23, 2020 Hi, for example you can search for the word Lamu and when you click the first result you will see that the post appears empty, it was built that way because those posts are feeding the info on the pop up windows here www.gypset.com/atlas we added the search feature way after this was built and I just want to hide those empty posts form the search results on the site. @creedon Link to comment
creedon Posted September 24, 2020 Share Posted September 24, 2020 Add the following to Custom CSS. .search-results /* corumbau */ [itemid="5e6179d6f042ba7f2e97e878"], /* esalen */ [itemid="5e617a32f11f6b3cb96f5997"], /* lamu */ [itemid="5e6173c14c8fbf134de4a15d"] { display: none; } This is just some starter CSS you will need to add an entry for each Atlas Map Locations post. For each post you need to get the itemid. View source for each page and look for '<body id="item-'. Be sure that each CSS entry is followed by a comma except the last one. Let us know how it goes. Find my contributions useful? Please like, upvote, mark my answer as best , and see my profile. Thanks for your support! Link to comment
creedon Posted September 24, 2020 Share Posted September 24, 2020 Here is a little something that might make the process a little easier. javascript: var itemId = document.querySelector ( 'body' ).getAttribute ( 'id' ).replace ( 'item-', '' ); var title = document.getElementsByClassName ( 'entry-title' ) [ 0 ].textContent; var s = '/* ' + title + ' */ [itemid="' + itemId + '"],'; alert ( s ); First you need to be on a Atlas Map Locations post page. There are two ways you can use the above. You can type it into the address bar and then hit return. Before you hit return make sure the "javascript: " is at the beginning of the code. Some browsers strip that part out as a safety step upon pasting. If you know how to create a bookmark in your browser you can throw the code in there creating what is called a Bookmarklet. The code then can be triggered by selecting the bookmark. The code throws up an alert with the title and item id. You can then copy and paste the dialog content into your CSS. The above code was thrown together quickly only for this site and to help with the above issue. Find my contributions useful? Please like, upvote, mark my answer as best , and see my profile. Thanks for your support! Link to comment
dani100 Posted April 29, 2022 Share Posted April 29, 2022 @creedon Is there a way to hide a collection (blog) page from search enginges, while keeping the blog articles themselves visible? Basically, I'd like to inject a summary block into a page and allow users to click through to blogs from there. But I never want them to stumble upon the /blog page itself. Thanks in advance for your help :) Link to comment
creedon Posted April 29, 2022 Share Posted April 29, 2022 5 minutes ago, dani100 said: Is there a way to hide a collection (blog) page from search enginges, I'm thinking no. We don't have access to the backend of SS. Anything we can do client side I'm dubious would have an effect on search engines. Find my contributions useful? Please like, upvote, mark my answer as best , and see my profile. Thanks for your support! Link to comment
dani100 Posted April 29, 2022 Share Posted April 29, 2022 @creedon Gotcha, thanks so much for your quick and clear reply :) Link to comment
mariescantrol Posted August 23, 2022 Share Posted August 23, 2022 This solution (display: none) for all the search results is so tedious. Why couldn't you implement a feature just like for SEO search where we can enable/disable blog posts to show up in the search bar? I'm doing so much copy and paste and finding itemids and the custom css is getting long... My goal is to have all blog posts never show up in squarespace search bar because we want to focus on searching for specific keywords with products. Also, i would like to be able to put this css codes just in /search page only, putting it in custom css means it will have to be in every single page... thanks Link to comment
creedon Posted August 23, 2022 Share Posted August 23, 2022 4 hours ago, mariescantrol said: Why couldn't you implement a feature just like for SEO search where we can enable/disable blog posts to show up in the search bar? I just don't see this happening. The site search feature has been broken for years and SS has not fixed it. Search is unreliable. Quote My goal is to have all blog posts never show up in squarespace search bar because we want to focus on searching for specific keywords with products. Add the following to Design > Custom CSS. .sqs-post:not( .sqs-post-type-store-item ) { display : none; } I haven't tested this extensively but this should hide all non product items. Keep in mind that this just hides things. So you can end up with a page full of nothing which may throw folks off thinking that there are no results. It really isn't an ideal solution. If search is mission critical to your site then SS search is not a good solution. You should look to something like Google's Programmable Search Engine. Find my contributions useful? Please like, upvote, mark my answer as best , and see my profile. Thanks for your support! Link to comment
mariescantrol Posted August 24, 2022 Share Posted August 24, 2022 Thanks Creedon, we don't have a "store" though, it's complicated but our website have products but they are just stand alone webpages since they are technically services. It's okay, I think I managed to manually have a solution. Also I don't know if it's good enough code but I added a code injection in header so it only applies search filters in the search page (/search - i couldnt edit it because ss has a default page for it) and i didn't put the codes in custom css. I added console log just to check to make sure it doesn't load in all the pages: Thanks 🙂 let myUrl = window.location.href; let result = myUrl.includes("search") ? insertSearchFilter() : noSearchFilter(); function insertSearchFilter() { // Get HTML head element var head = document.getElementsByTagName('HEAD')[0]; // Create new link Element var link = document.createElement('link'); // set the attributes for link element link.rel = 'stylesheet'; link.type = 'text/css'; link.href = 'https://www.YOURWEBSITEURL.com/s/search-results.css'; // Append link element to HTML head head.appendChild(link); console.log("IN SEARCH PAGE"); }; function noSearchFilter() { console.log("NOT IN SEARCH PAGE"); }; Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment