Need Help with Collection code rewrite

Topic summary

A user is customizing a collection page on a third-party Shopify theme (Ubone) to display the collection image and description side-by-side instead of stacked vertically. The collection images are 800x400px.

Technical Context:

  • The user is integrating the Searchanise app into the collection page
  • Most integration work is complete except for the header layout
  • The code involves Liquid templating and CSS styling

Solution Provided:
A community member (wo) provided restructured Liquid code that reorganizes the DIV elements, placing the description and image blocks in a flex container. The CSS solution includes:

  • Flexbox layout with justify-content: space-between
  • Description at 33% width, image at 63% width
  • Responsive design with mobile breakpoint at 750px (stacks elements at 100% width)

Current Status:
The second CSS solution successfully achieved the side-by-side layout. The user is now asking about adding a height constraint to the image within this code structure. The discussion remains open with this follow-up question pending.

Summarized with AI on November 5. AI used: claude-sonnet-4-5-20250929.

Collections page: I need assistance in getting this piece of code rewritten so that the collection description and the collection image are side by side. My collection images are 800x400px.

Current Look;

Need Look:


              ###### {{ collection.title }} ({{ collection.all_products_count }})
              {%- if section.settings.collection_info_enable -%} 
             
                {%- if section.settings.collection_image_enable -%}
                

                  {% if collection.image %}
                    {%- if collection.image != blank -%}
                      {{ collection.image | image_url: width: 1920 | image_tag:
                        loading: 'lazy',
                        width: collection.image.width,
                        height: collection.image.height,
                        class: "img-fluid lazyload",
                        alt: collection.image.alt | escape }}
                    {%- else -%}
                    {{ 'hero-apparel-1' | placeholder_svg_tag }}
                    {%- endif -%}
                  {% else %}
                  {%- if section.settings.collection_image != blank -%}
                      {{ section.settings.collection_image | image_url: width: 1920 | image_tag:
                        loading: 'lazy',
                        width: section.settings.collection_image.width,
                        height: section.settings.collection_image.height,
                        class: "img-fluid lazyload",
                        alt: section.settings.collection_image.alt | escape }}
                    {%- else -%}
                    {{ 'hero-apparel-1' | placeholder_svg_tag }}
                    {%- endif -%}
                  {% endif %}
                

                {%- endif -%}
                {%- if section.settings.collection_desc_enable -%}
                
                  {% if collection.description != '' %}
                  {{ collection.description }}
                  {% else %}
                  

{{ section.settings.collection_desc | truncate: 190 }}

                  {% endif %}
                

                {%- endif -%}
              

              {%- endif -%}
            

Any help is appreciated.

1 Like

Hi @Katstormphoto

Would you mind sharing your store URL? Thanks!

My store URL is katstormphoto.com but the change I’m needing made is for a new theme design I’m working on.

Please, shre the theme that you like to change. Preview is also okay. Thanks!

The theme I am working on is not a Shopify theme but a 3rd party theme called Ubone and I am adjusting the collection page to integrate the Searchanise app. I have made all the necessary changes for the integration except for getting this collection header part to look right. Code attached is what I currently have for the “Collection Page”, once I get the header correct I will thin out parts of the Schema" that aren’t needed.


  

                

              ###### {{ collection.title }} ({{ collection.all_products_count }})
              {%- if section.settings.collection_info_enable -%} 
             
                {%- if section.settings.collection_image_enable -%}
                

                  {% if collection.image %}
                    {%- if collection.image != blank -%}
                      {{ collection.image | image_url: width: 1920 | image_tag:
                        loading: 'lazy',
                        width: collection.image.width,
                        height: collection.image.height,
                        class: "img-fluid lazyload",
                        alt: collection.image.alt | escape }}
                    {%- else -%}
                    {{ 'hero-apparel-1' | placeholder_svg_tag }}
                    {%- endif -%}
                  {% else %}
                  {%- if section.settings.collection_image != blank -%}
                      {{ section.settings.collection_image | image_url: width: 1920 | image_tag:
                        loading: 'lazy',
                        width: section.settings.collection_image.width,
                        height: section.settings.collection_image.height,
                        class: "img-fluid lazyload",
                        alt: section.settings.collection_image.alt | escape }}
                    {%- else -%}
                    {{ 'hero-apparel-1' | placeholder_svg_tag }}
                    {%- endif -%}
                  {% endif %}
                

                {%- endif -%}
                {%- if section.settings.collection_desc_enable -%}
                
                  {% if collection.description != '' %}
                  {{ collection.description }}
                  {% else %}
                  

{{ section.settings.collection_desc | truncate: 190 }}

                  {% endif %}
                

                {%- endif -%}
              

              {%- endif -%}
            

    
{% render 'searchanise-navigation' %}
  

{% schema %}
{
  "name": "Collection",
  "settings": [
    {
      "type": "header",
      "content": "Container"
    },
    {
      "type": "select",
      "id": "container",
      "label": "Container",
      "options": [
        {
          "label": "Fluid",
          "value": "fluid"
        },
        {
          "label": "Normal",
          "value": "normal"
        }
      ],
      "default": "normal"
    },
    {
      "type": "header",
      "content": "Section Backgorund Color"
    },
    {
      "type": "color",
      "id": "collection_bgcolor",
      "label": "Background Color",
      "default": "#FFFFFF"
    },
    {
      "type": "checkbox",
      "id": "collection_bgcolor_enable",
      "label": "Show Backgorund Color",
      "default": true
    },
    {
      "type": "header",
      "content": "Product Options"
    },
    {
      "type": "number",
      "id": "products_limit_handle",
      "label": "Product limit",
      "default": 20,
      "info": "How many posts will appear on each page"
    },
    {
      "type": "select",
      "id": "product_view",
      "label": "Slides per view desktop",
      "options": [
        {
          "label": "2 Products",
          "value": "grid-2"
        },
        {
          "label": "3 Products",
          "value": "grid-3"
        },
        {
          "label": "4 Products",
          "value": "grid-4"
        },
        {
          "label": "5 Products",
          "value": "grid-5"
        },
        {
          "label": "6 Products",
          "value": "grid-6"
        }
      ],
      "default": "grid-3"
    },
    {
      "type": "select",
      "id": "product_view_lg",
      "label": "Slides per view ipad",
      "options": [
        {
          "label": "2 Products",
          "value": "grid-lg-2"
        },
        {
          "label": "3 Products",
          "value": "grid-lg-3"
        },
        {
          "label": "4 Products",
          "value": "grid-lg-4"
        }
      ],
      "default": "grid-lg-4"
    },
    {
      "type": "select",
      "id": "product_view_sm",
      "label": "Slides per view mobile",
      "options": [ 
        {
          "label": "1 Products",
          "value": "grid-sm-1"
        },
        {
          "label": "2 Products",
          "value": "grid-sm-2"
        }
      ],
      "default": "grid-sm-2"
    },
    {
      "type": "header",
      "content": "Collection Information"
    },
    {
      "type": "checkbox",
      "id": "collection_info_enable",
      "label": "Show Collection Image/Description",
      "default": true
    },
    {
      "type": "image_picker",
      "id": "collection_image",
      "label": "Collection Image",
      "info": "Recommended Size: 1410px x 365px"
    },
    {
      "type": "checkbox",
      "id": "collection_image_enable",
      "label": "Show Collection Image",
      "default": true
    },
    {
      "type": "textarea",
      "id": "collection_desc",
      "label": "Collecton Description",
      "default": "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book"
    },
    {
      "type": "checkbox",
      "id": "collection_desc_enable",
      "label": "Show Collection Description",
      "default": false
    },
    {
      "type": "header",
      "content": "Collection Sorting"
    },
    {
      "type": "checkbox",
      "id": "tab_bar_enable",
      "label": "Show Grid/List View",
      "default": true
    },
    {
      "type": "checkbox",
      "id": "short_by_enable",
      "label": "Show Short By",
      "default": true
    },
    {
      "type": "header",
      "content": "Collection Sidebar"
    },
    {
      "type": "radio",
      "id": "sidebar_handle",
      "label": "Sidebar Position",
      "options": [
        {
          "label": "Left Sidebar",
          "value": "left_sidebar_handle"
        },
        {
          "label": "Right Sidebar",
          "value": "right_sidebar_handle"
        },
        {
          "label": "Without Sidebar",
          "value": "without_sidebar"
        }
      ],
      "default": "left_sidebar_handle"
    },
    {
      "type": "header",
      "content": "Sidebar Categories"
    },
    {
      "type": "text",
      "id": "collection_categories_title",
      "label": "Categories Title",
      "default": "Categories"
    },
    {
      "type": "checkbox",
      "id": "collection_categories_enable",
      "label": "Show Categories",
      "default": false
    },
    {
      "type": "header",
      "content": "Sidebar Banner"
    },
    {
      "type": "image_picker",
      "id": "sidebar_banner_img",
      "label": "Sidebar Image",
      "info": "Recommended Size: 350x470px"
    },
    {
      "type": "url",
      "id": "sidebar_banner_url",
      "label": "Image URL"
    },
    {
      "type": "checkbox",
      "id": "sidebar_banner_enable",
      "label": "Show Banner",
      "default": true
    },
    {
      "type": "header",
      "content": "Collection Product"
    },
    {
      "type": "text",
      "id": "special_pro_title",
      "label": "Product title",
      "default": "Special product"
    },
    {
      "type": "collection",
      "id": "special_pro",
      "label": "Select Collection"
    },
    {
      "type": "number",
      "id": "special_pro_limit",
      "label": "Collection product limit",
      "default": 12
    }
  ]
}
{% endschema %}

It only requires CSS, not Liquid. So if the design is not visible, it may be difficult to provide a solution.

I just need to know how to recode the original script (code) that I posted to reorganize the “DIV” parts so that the image is side-by-side with the collection description.

My current active theme was adjusted using the following code to give it the look that I desired but I am unsure of how to adjust the code for the theme I’m working on because the code labels are slightly different.


  

  # {{collection.title}}
  {%- if col_description and collection.description != blank -%}
    {{collection.description}}

  {%- endif -%}
  

  {%- if collection.image and collection.image != blank -%}
  
    {%- render 'image-style' image: collection.image -%}
  

  {%- endif -%}

That’s about it. You can adjust it according to your actual situation.


              {%- if section.settings.collection_info_enable -%} 
             

{%- if section.settings.collection_desc_enable -%}
                

              ###### {{ collection.title }} ({{ collection.all_products_count }})
                  {% if collection.description != '' %}
                  {{ collection.description }}
                  {% else %}
                  

{{ section.settings.collection_desc | truncate: 190 }}

                  {% endif %}
                

                {%- endif -%}
              

              {%- endif -%}
                {%- if section.settings.collection_image_enable -%}
                
                  {% if collection.image %}
                    {%- if collection.image != blank -%}
                      {{ collection.image | image_url: width: 1920 | image_tag:
                        loading: 'lazy',
                        width: collection.image.width,
                        height: collection.image.height,
                        class: "img-fluid lazyload",
                        alt: collection.image.alt | escape }}
                    {%- else -%}
                    {{ 'hero-apparel-1' | placeholder_svg_tag }}
                    {%- endif -%}
                  {% else %}
                  {%- if section.settings.collection_image != blank -%}
                      {{ section.settings.collection_image | image_url: width: 1920 | image_tag:
                        loading: 'lazy',
                        width: section.settings.collection_image.width,
                        height: section.settings.collection_image.height,
                        class: "img-fluid lazyload",
                        alt: section.settings.collection_image.alt | escape }}
                    {%- else -%}
                    {{ 'hero-apparel-1' | placeholder_svg_tag }}
                    {%- endif -%}
                  {% endif %}
                

                {%- endif -%}
               
            

Thank you, this code worked with a little modification. I had to move this second

{%- endif -%} 

down to the bottom of the last one to get the description side-by-side of the collection image.

Question: How would I adjust the flex part of your code to get the description (collection-info) at 33% of the width and the image in the remaining space?

Thanks

I’m not sure what your modified structure is. If it is the following code


/*****  title and description **********/

/*********** image  **********/

Then, the css code can be like this.

.collection-img-wrap{display:flex;justify-content: space-between;}
.collection-img-wrap .collection-info{flex: 1 1 33%;}
.collection-img-wrap .collection-image{flex: 1 1 63%;}
@media (max-width: 750){ 
.collection-img-wrap{flex-wrap:wrap;}
.collection-img-wrap .collection-info, .collection-img-wrap .collection-image{flex: 1 1 100%;}
}

If it is the following code.


............title and description ..............

..........image.........

Then, the CSS code can be like this.

.collection-info{display:flex;justify-content: space-between;}
.collection-info .collection-description{flex: 1 1 33%;}
.collection-info .collection-image{flex: 1 1 63%;}
@media (max-width: 750){ 
.collection-info{flex-wrap:wrap;}
.collection-info .collection-description,.collection-info .collection-image{flex: 1 1 100%;}
}

Thanks, the 2nd solution worked. I there a way to add an image height to this code?