A Shopify store owner using the Dawn theme seeks to add a “Read More/Read Less” button to collection descriptions to improve user experience when descriptions are lengthy.
Solutions Provided:
Two community members offered code solutions for the main-collection-banner.liquid file:
Swym’s approach: Add an ID attribute to the description element, insert a Read More/Less button, and include CSS/JavaScript for styling and functionality
Dan-From-Ryviu’s approach: Replace the collection description code with a version that limits display to 2 lines initially, with expandable functionality
Implementation Issues:
The original poster reports:
Swym’s solution works well but requests refinements: positioning the button inline at the end of text (with ellipsis), and hiding the button when descriptions are short
Dan’s solution functions properly but triggers a JavaScript error when viewing collections in the Shopify editor
Current Status:
Swym requests clarification on maximum description length and preferred button positioning (single-line vs. multi-line preview) to provide further customization. Dan provided an updated code snippet to address the editor error. The discussion remains open with ongoing refinements.
Summarized with AI on October 30.
AI used: claude-sonnet-4-5-20250929.
I’m looking for some help to add a read more and read less button to collection descriptions to make screens more user friendly. Some of my descriptions are getting quite long and causing the user to have to scroll down to see the collection products. I’ve tried a number of solutions I’ve found on the internet and can’t find one that works for all my collection pages. I found one solution that worked for some of my collection descriptions however on others it gave me an HTML error saying there was broken code. I’m using the dawn theme and would really appreciate some guidance on how to get this to work.
To add the styling and functionality, add the following CSS and JavaScript at the bottom of the file:
Done? Now, save the file and preview your collection page. If everything was updated correctly, the Read More / Less button should appear and function as expected.
I hope this helps!
If my response helped you, please consider giving it a like ( ) and marking it as an accepted solution if it resolved your issue. Your feedback helps other community members with similar questions.
This worked great - thank you so much! A couple of quick questions on the layout of it - is it possible to get the show less and the show more to appear at the end of the line as opposed to below the text, and after … to show that the text is to be continued, for example:
"This is the webpage…read more
Also is there a way to hide the show more and show less when the text on the page doesn’t actually need it i.e. on a short page?
Thank you for this. It works well and looks good however when I am viewing the collections inside the editor I receive the error: An embedded page at …my website.myshopify.com says: This link cannot be opened inside the editor. It will be opened in a new window (javascript:void(0)). Click OK to continue.
This happens each time I click on a different collection page.
Is it possible to get the show less and the show more to appear at the end of the line as opposed to below the text
Yes it is possible but follow up question to that will be what is the maximum length of the descriptions for which you want to show the read more/ less buttons? And also do you want the read more/ less buttons to show up on the first line itself like the way you explained or show 2 -3 lines of small content of the description and then show the button?
If its the single line approach then I can suggest some solution to you but for the multi-line preview before showing the button there are complexities involved in terms of designing and positioning the button and so it would be time consuming and I wont be able to assist with you on that here and in that case and maybe you can go with some developer help.
Also is there a way to hide the show more and show less when the text on the page doesn’t actually need it i.e. on a short page?
Yes, you can hide the “Show More” button when the text is already short enough. To implement this properly, I’d need to know the exact limit (either by character count) where you want the button to appear.