Jump to content

Adding Category Descriptions by Category Page

Recommended Posts

On 9/7/2023 at 4:29 AM, Josianne said:

Hello here !

I tried to install this code on my site, following the instructions.

I started on this section to see, but it does not work for me! 

https://www.cordeetficelle.com/boutique/cache-pots-et-vase

 

 

Can you help me ?

test.jpg

You mean add description here?

image.thumb.png.648a2aa0ec832f99fb35efebe2bced88.png

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
On 9/6/2023 at 2:29 PM, Josianne said:

I tried to install this code on my site, following the instructions.

You skipped the first step of installing twcsl.

  • Install twcsl. After you install twcsl be sure to continue on with the rest of the steps.

Let us know how it goes.

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.

Link to comment
  • 2 weeks later...
  • 3 weeks later...

Hello @creedon

I tried implementing your code on my website, but that didn't work.

Like others, I created a "shop all" page, as well as category pages. I would like to have a custom description at the top of each of my category pages. Right now, the description of "shop all" appears on all the category pages.

See here:

- Shop all: https://wateroverleaves.com/shop-all

- Category page: https://wateroverleaves.com/shop-all?category=Organic

 

Using your documentation, I am stuck here:

"Add a section to the store page list as the last section. Add a code block to the section and set the content to the following. Read the code for any instructions within."

=> I don't understand where to put the code. 

I am able to put a code section at the top of "shop-all", but not as "last section". And when trying as intro, the copy appears on all my categories.

 

Not sure what I am doing wrong.

Could you help me?

 

Thanks

 

 

Link to comment
2 hours ago, mp2018 said:

I tried implementing your code on my website, but that didn't work.

It's not going to work because my code is written for v7.1 and your site is v7.0 in Developer Mode.

Please see the following for some v7.0 code that may work. I can't say for sure as it wasn't developed for Developer Mode.

Note : DO NOT TURN OFF Developer Mode as you may destroy your site.

 

Edited by creedon

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.

Link to comment
39 minutes ago, mp2018 said:

it's not working either on my website. 

You have syntax errors in your code.

The following should be changed from...

<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script>
  
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>

...to...

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>

Also note that you generally only need one, most recent, copy of jQuery installed.

You should also remove the v7.1 code you installed as it is doing nothing for your v7.0 site and muddling issues.

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.

Link to comment
1 hour ago, tomtom151 said:

I am having the same issue with not being able to add individual descriptions to individual categories within my shop. Could I please get assistance with this?

What is your issue? Have you tried installing some code as suggested?

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.

Link to comment
9 minutes ago, tomtom151 said:

I am struggling in any of these forum posts to find the actual code to implement and the instructions.

I have code in my May 6, 2021 post in this thread that may be of use. You'll need to determine if it will work with your version of SS and for your need.

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.

Link to comment
  • 4 weeks later...

Hi @creedon

First off, thanks for this great bit of code! Transitioning from 7.0 to 7.1 now, and this is very helpful in retaining one of core website features.

I managed to get everything to work well - though I had a question to which I couldn't find an answer in the documentation. Feel like I may be I missed something obvious.

Q: Is it possible to create line breaks within the text? I tried using <br> between sentences, though it did not seem to work for me. I have very minimal HTML and CSS knowledge, so perhaps there's something simple here that I am missing. Some of my descriptions are quite long and breaking them up into individual lines would be hugely helpful.

Please let me know if there's a way to implement this.

 

Thanks again,

Maks

-

Link to comment
1 hour ago, Gerhard said:

Is it possible to create line breaks within the text? I tried using <br> between sentences, though it did not seem to work for me

The intent of the code is to allow some HTML but there is currently a bug in the code. I will attempt to address it. Please give me several days. If you don't hear from me, please bump this thread.

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.

Link to comment
Quote

The intent of the code is to allow some HTML but there is currently a bug in the code.

I have updated my code in my May 6, 2021 post.

From the changes...

  • second fix for description html not coming through

Please note that the element where you define your data has changed.

Let me know how it goes.

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.

Link to comment
  • 3 weeks later...

Edit 12.07.2.23: I managed to change the max text width in the Product Header Code Injection Page. Just had to remove the dividing line in order to make it clean, as I couldn't change the line width to scale independently from the text. Still on the 0.7.3 version - but with my fix I didn't need to do any additional HTML. Thanks again!

 

Another quick one for you!

I just realized, after some thought, that doing line breaks would actually be a less efficient way of doing what I wanted. I'm thinking about a way to set the max width of the description text so that it reads a little more like a paragraph, and less like a long line of text at the top of the page. Is there a way to set an attribute so that it moves text to the next line once the width of the text exceeds something like 960 pixels? so about 50% of a full 1920 page width?

Additionally, I can easily change the text type on the paragraph text (thanks for the thorough description on how to do that in your documentation!), but is there a way to do the same with the title text? I'm hoping to make it bold.

Thanks again for your help with this!

Edited by Gerhard
Update
Link to comment
On 12/7/2023 at 12:10 AM, jennis said:

Do you mind checking what's wrong with my coding?

Yes you have syntax errors in your code. Please try the following.

  <script data-twc-splcda type="application/ld+json">
  
    /*
    
      the format of each entry is a category list and a description for the
      category list
      
      for category list use values from Store Settings > Categories >
      [category name] > Edit > NAME field for the store page. you need all
      the text from the field. if you want to add a description to the
      main store page use All for the category list
      
      for a top level category you would enter something like...
      
        Top Category
        
      For a nested category you enter something like...
      
        Top Category > Sub Category
        
      following is an example entry. copy the example entry below and paste
      after the example entry, removing the double forward slash space lines
      from the beginning of each line. repeat for as many categories as you want
      to add a description. this has been done once initially
      
      if your description contains double quote characters they will need to be
      escaped. " becomes \"
      
      */
      
    {
    
      // "[enter category list here replacing square brackets]" : "
      
      //   [enter category description here replacing square brackets]
        
      //   ",
            
      "Cotton Bags" : "
      
        Cotton bags description
        
        ",
        
      "Art" : "
      
        Art description
        
        ",
        
      "Posters" : "
      
        Posters description
        
        ",
        
      }
      
    /*
    
      Optional Attribtues
      
      there are three optional attributes that can be added to the script tag
      
        data-paragraph-style
        
          value is one of the following. the default is Heading 3
          
            Heading 1
            Heading 2
            Heading 3
            Heading 4
            Paragraph 1
            Paragraph 2
            Paragraph 3
            Monospace
            
        data-selector-destination
        
          value is any valid selector value. the default is
          .nested-category-title
          
        data-action
        
          value is one of the following. the default is after
          
            after
            append
            before
            prepend
            
      Example of Adding an Attribute
      
        <script data-twc-splcda data-paragraph-style="Heading 1 type="application/ld+json"">
        
      */
      
    </script>

Let us know how it goes.

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.

Link to comment
  • 4 weeks later...

Hello @creedon,

 

I've reread and tested all the codes you've given to add a personalized description to each category page in my shop. But it doesn't work for me.

For the moment I've added a block with text above my category (catalog) but it can't be customized because on each of my category pages it's always the same text that's displayed.

I understood that the code had changed following an update but even with the latest codes from 2023, I can't manage to customize the description on my category pages.

When I add the codes, I always get an error message about the syntax.

Can you help me?

Capture d’écran 2024-01-10 à 16.30.03.png

Link to comment

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.