JamIsJam88 Posted March 24, 2021 Share Posted March 24, 2021 Site URL: https://www.yungrealestate.com/availabilities/26-east-sunset-dr How can I hide the current blog post in a summary block site-wide so that I don't have to code it for each blog post or make specific tags for each property? If I have a summary block on a property listing, I would prefer not to have it display the current property on it. emalu 1 Link to comment
ChristosVayenas Posted July 27, 2022 Share Posted July 27, 2022 Hello there, did you ever find a solution to this question? Link to comment
tuanphan Posted July 28, 2022 Share Posted July 28, 2022 Try adding this to Code Injection > Footer <script> window.addEventListener('load', function () { function removeMatchingPageFromRelatedPosts() { var currentPath = window.location.pathname; var matchingSummaryItem = document.querySelector( `[href="${currentPath}"]` ); if (!matchingSummaryItem) return; var summaryParent = matchingSummaryItem.closest('.summary-item'); summaryParent.remove(); console.log('matching blog post removed'); window.Squarespace.initializeLayoutBlocks(Y); } removeMatchingPageFromRelatedPosts(); }); </script> Code by @RyanDejaegher Quote https://ryandejaegher.com/remove-current-post-summary-block-squarespace/ Email me if you have need any help (free, of course.). Answer within 24 hours. Or send to forum message Contact Customer Care - Learn CSS - Buy me a coffee (thank you!) Link to comment
ChristosVayenas Posted July 29, 2022 Share Posted July 29, 2022 That worked perfectly, amazing, thank you! Link to comment
abc Posted September 17, 2023 Share Posted September 17, 2023 @tuanphan @RyanDejaegher Do you guys know a code that would work for store products by any chance? I need to exclude the current product from a summary block. Link to comment
tuanphan Posted September 19, 2023 Share Posted September 19, 2023 On 9/17/2023 at 10:53 PM, pro said: @tuanphan @RyanDejaegher Do you guys know a code that would work for store products by any chance? I need to exclude the current product from a summary block. Can you share link to page where you use summary block? Email me if you have need any help (free, of course.). Answer within 24 hours. Or send to forum message Contact Customer Care - Learn CSS - Buy me a coffee (thank you!) Link to comment
abc Posted September 19, 2023 Share Posted September 19, 2023 (edited) 3 hours ago, tuanphan said: Can you share link to page where you use summary block? Thank you, Tuan. Here you go: https://steven.squarespace.com/clients/p/blackfoot-hospitality Edited September 19, 2023 by pro Link to comment
tuanphan Posted September 21, 2023 Share Posted September 21, 2023 On 9/19/2023 at 7:22 PM, pro said: Thank you, Tuan. Here you go: https://steven.squarespace.com/clients/p/blackfoot-hospitality Use this code to CSS box .ProductItem .ProductItem-additional .summary-item:first-child { display: none; } .ProductItem .ProductItem-additional .summary-item { clear: none !important; } Email me if you have need any help (free, of course.). Answer within 24 hours. Or send to forum message Contact Customer Care - Learn CSS - Buy me a coffee (thank you!) Link to comment
abc Posted September 22, 2023 Share Posted September 22, 2023 14 hours ago, tuanphan said: Use this code to CSS box .ProductItem .ProductItem-additional .summary-item:first-child { display: none; } .ProductItem .ProductItem-additional .summary-item { clear: none !important; } Hi Tuan, unfortunately, this code only works if the excluded item is first-child. But it's not always the case in my store. Sometimes the excluded item is first, other times it's 2nd, or 3rd, or last. Is there a JS code that would automatically exclude the current product no matter its position in the summary block? The JS code you quoted earlier in the thread works perfectly for blog posts, but not for store products. Link to comment
tuanphan Posted September 25, 2023 Share Posted September 25, 2023 On 9/22/2023 at 7:08 AM, pro said: Hi Tuan, unfortunately, this code only works if the excluded item is first-child. But it's not always the case in my store. Sometimes the excluded item is first, other times it's 2nd, or 3rd, or last. Is there a JS code that would automatically exclude the current product no matter its position in the summary block? The JS code you quoted earlier in the thread works perfectly for blog posts, but not for store products. I have no ideal, you try contacting RyanDejaegher Email me if you have need any help (free, of course.). Answer within 24 hours. Or send to forum message Contact Customer Care - Learn CSS - Buy me a coffee (thank you!) Link to comment
takis-7124 Posted March 15 Share Posted March 15 On 9/22/2023 at 3:08 AM, abc said: Hi Tuan, unfortunately, this code only works if the excluded item is first-child. But it's not always the case in my store. Sometimes the excluded item is first, other times it's 2nd, or 3rd, or last. Is there a JS code that would automatically exclude the current product no matter its position in the summary block? The JS code you quoted earlier in the thread works perfectly for blog posts, but not for store products. Did you manage to find a workaround on that @abc? Exact same problem 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