Jump to content

Add White Space to End of Product Description Lines for CSV Export

Recommended Posts

Posted

Hi all, I'm trying to figure out how to add some white space as padding to the end of paragraphs/lines in product descriptions. As far as I can tell, Squarespace automatically strips white space at the end of lines when saving, so I can't just add a few spaces and call it a day. Chatting with Squarespace support, they suggested that custom coding might do it. However, I have no idea where to start so looking for some help how to achieve this

For some context, the reason I am doing this is to workaround an existing bug in Squarespace where rich text formatting in product descriptions does not properly get transferred over in export (e.g. when integrating with Facebook Marketplace to export product listings to that platform). I suspect this may be due to the fact that behind the scenes all the product information is being exported via CSV (the feed URL downloads a CSV if I put it in my browser), which can't really retain things like bullet points. This results in all my product description text being smashed together into one long paragraph without any carriage returns and the bullet points and other styling removed. I could live with this until a proper fix is in place IF I could figure out how just to pad the lines a little so when they are all clumped together into one large paragraph without bullet points they had proper spacing between sentences.

To get an idea of the problem I'm trying to overcome, see attached screenshots. The formatting as I enter it into Squarespace appears on the website with the proper rich text formatting (e.g. bullet points). When this gets put into the CSV, all the rich text is removed and all the lines are smashed together into one big paragraph. In Facebook, the description results in basically the same (although it turns the ASCII codes for some of the advanced characters back into what they should be which is nice).

Thus, how do I add a little bit of padding/white space to the end of lines in Squarespace that make it into the CSV export and thus properly appear when imported by the final destination, without affecting how this all appears on my Squarespace site?

Any suggestions would be much appreciated! Thanks.

 

Squarespace Product Description Formatting.jpg

Feed CSV Description Formatting.jpg

Facebook Marketplace Description Formatting.jpg

Posted

I suggest tackling this issue after the CSV has been exported from SS.

The Description field in the CSV looks something like the following. I formatted the one line output for easier reading here.

<p class="">

  It all begins with an idea. Maybe you want to launch a business.
  
  </p>
  
<ul data-rte-list="default">

  <li>
  
    <p class="">
    
      Maybe you want to turn a hobby into something more.
      
      </p>
      
    </li>
    
  <li>
  
    <p class="">
    
      Or maybe you have a creative project to share with the world.
      
      </p>
      
    </li>
    
  <li>
  
    <p class="">
    
      Whatever it is, the way you tell your story online can make all the difference.
      
      </p>
      
    </li>
    
  </ul>
  
<p class="">

  This a line 1
  
  </p>
  
<p class="">

  This is line 2
  
  </p>
  
<p class="">

  This is line 3
  
  </p>
  
<p class="">

  </p>

SS retains the HTML of the description and so it is possible to massage it into other formats that can be imported into other systems.

How you format it is up to you. You could use a spreadsheet formula or even a bit of script if you import the CSV into Google Sheets.

SS suggesting coding to solve the issue on the platform is not very helpful. We can't write code to do magic on the backend of their system. Any code we could write would be client side. To try and format your product descriptions in some format and use code to process it for output on the page to get back your bullet formatting sounds like a pain and fragile.

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.

Posted (edited)

Thanks for the thoughtful reply.

There's a couple things here:

  • I'm trying to keep this fully automated and reuse as much of the pre-existing feed plumbing that exists in Squarespace as possible so that I can use the sync feed as an input for various platforms (besides just FB). In other words, I'd prefer not to have to do manual exports every time I make a change or to update stock counts (and thus, probably, manual imports to these other platforms or at least an intermediary location like Google Drive). I realize that maybe that is the only option and there's no way around the manual export, in which case I'm out of luck. Is there anyway to automate those exports at least, for example to trigger it any time there is a change in the product listings or once per day?
  • Interesting that the CSV export done manually (that you show a snip from) is formatted differently than the CSV export that is created by the feed Squarespace uses to sync with Facebook Marketplace/Instagram. No HTML at all in the description field in that one. Don't know what to make of that. Maybe that's another showstopper to doing this in an automated way reusing that stuff.

Ultimately it sounds like there's no way to get a little extra padding in there before so that it makes its way into the CSV or CSV generated for the sync feed. I guess doing a manual export of the CSV is a hard limitation, or is there some way to automate that at least so I can try delving into what you suggest and make some kind of script or formula that could make the proper tweaks while the file is hosted in some intermediary area?

Thanks again for the help.

Edited by mikewr
Posted

I'm not a Squarespace/Facebook integration expert but it sounds like you've linked SS into FB and FB is pulling store page data into your FB site.

You mentioned a CSV feed URL that FB reads. Can you share that URL? I'd be interested in seeing the output. The output I showed in my post is the standard SS export inventory export format. I'm not surprised there is a difference between to two because of their end purposes.

I think you've sussed correctly that there is basically nothing you can do within SS unless you can stage the CSV in an intermediary location with some kind of formula/script processing to fix the formatting before it gets imported into wherever it is ending up.

If anyone else has thoughts on this please do chime in!

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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.