Blog, Website & Page Publishing

CCioc
Participant

Side-by-Side Image and Text Column in Blog

SOLVE

Hey,

I am trying to write an article for my blog, and I wanted to add some images in to space things out a bit. I cannot, for the life of me, figure out how to add an image, but leave room to the side of it for text.

The default way is I can add an image, adjust the size to fit in the text, but I cannot get the text to sit to the right of the image, only below or above it. 
Ideally, the text would be to the right of the image for PC and larger browsers, and above the text on mobile.

If anyone knows how to add in the columns (like you would on the website when adding sections) with an image+text that would be great!

0 Upvotes
1 Accepted solution
Anton
Solution
Thought Leader | Partner
Thought Leader | Partner

Side-by-Side Image and Text Column in Blog

SOLVE

Hey @CCioc

while you can add an image via rich-text, I don't recommend it. 

Du to how the blog drag&drop works, I'd recommend to create a simple custom module and use it for such "two column" layouts. 

 

Here's a basic code you can use for this:

module.html:

<div class="twoColWrapper">
  {# image #}
  {% if module.image.src %}
  <div class="imageWrapper">
	{% set sizeAttrs = 'width="{{ module.image.width|escape_attr }}" height="{{ module.image.height|escape_attr }}"' %}
	{% if module.image.size_type == 'auto' %}
		{% set sizeAttrs = 'width="{{ module.image.width|escape_attr }}" height="{{ module.image.height|escape_attr }}" style="max-width: 100%; height: auto;"' %}
	{% elif module.image.size_type == 'auto_custom_max' %}
		{% set sizeAttrs = 'width="{{ module.image.max_width|escape_attr }}" height="{{ module.image.max_height|escape_attr }}" style="max-width: 100%; height: auto;"' %}
	{% endif %}
	 {% set loadingAttr = module.image.loading != 'disabled' ? 'loading="{{ module.image.loading|escape_attr }}"' : '' %}
	<img src="{{ module.image.src|escape_url }}" alt="{{ module.image.alt|escape_attr }}" {{ loadingAttr }} {{ sizeAttrs }}>
  </div>
  {% endif %}
  {# content #}
  {% unless module.content == "" %}
    <div class="contentWrapper">
	  {% inline_rich_text field="content" value="{{ module.content }}" %}
  </div>
  {% endunless %}
</div>

 

module.css:

.twoColWrapper{
  display:flex;
  flex-direction: column;
  gap: 32px;
}
.twoColWrapper .imageWrapper, .twoColWrapper .contentWrapper{
  max-width:100%;
  height:auto;
}

@media screen and (min-width:1024px){
  .twoColWrapper{
	flex-direction:row;
  }
}

 

the fields:

Bildschirmfoto 2025-02-12 um 12.32.43.png

 

You can add quite a lot more options to this if you need

 

 

best, 

Anton

Anton Bujanowski Signature

View solution in original post

4 Replies 4
CCioc
Participant

Side-by-Side Image and Text Column in Blog

SOLVE

Hey, 

So I was able to figure out how to wrap text around an image. When you select the image there's a toolbar that appears above it with some alignment options for the image around the nearest text. I was able to make a much better looking article because I found that. 

 

I do actually have another question though. My website works fine on a computer, but for some reason on mobile the header is all jumped together. I've tried resizing my logo but it didn't help.

I'm using the Trainer theme, which is geared towards Independent Personal Trainers like myself. In the themes header layout there are 3 static modules, the logo, navigation, and search features. I have added a social link module as well, though I would rather avoid removing it, I don't think that would solve the problem.

Here is an image of the website on mobile. You can see it's impossible to use. Is there any way to go into the design manager for the theme and take away the search feature? I have get little experience with technical coding in HTML especially... Is there any other way to adjust how the layout is on mobile? 

1000002614.png

Thank you in advance! 

- Chris

0 Upvotes
Anton
Solution
Thought Leader | Partner
Thought Leader | Partner

Side-by-Side Image and Text Column in Blog

SOLVE

Hey @CCioc

while you can add an image via rich-text, I don't recommend it. 

Du to how the blog drag&drop works, I'd recommend to create a simple custom module and use it for such "two column" layouts. 

 

Here's a basic code you can use for this:

module.html:

<div class="twoColWrapper">
  {# image #}
  {% if module.image.src %}
  <div class="imageWrapper">
	{% set sizeAttrs = 'width="{{ module.image.width|escape_attr }}" height="{{ module.image.height|escape_attr }}"' %}
	{% if module.image.size_type == 'auto' %}
		{% set sizeAttrs = 'width="{{ module.image.width|escape_attr }}" height="{{ module.image.height|escape_attr }}" style="max-width: 100%; height: auto;"' %}
	{% elif module.image.size_type == 'auto_custom_max' %}
		{% set sizeAttrs = 'width="{{ module.image.max_width|escape_attr }}" height="{{ module.image.max_height|escape_attr }}" style="max-width: 100%; height: auto;"' %}
	{% endif %}
	 {% set loadingAttr = module.image.loading != 'disabled' ? 'loading="{{ module.image.loading|escape_attr }}"' : '' %}
	<img src="{{ module.image.src|escape_url }}" alt="{{ module.image.alt|escape_attr }}" {{ loadingAttr }} {{ sizeAttrs }}>
  </div>
  {% endif %}
  {# content #}
  {% unless module.content == "" %}
    <div class="contentWrapper">
	  {% inline_rich_text field="content" value="{{ module.content }}" %}
  </div>
  {% endunless %}
</div>

 

module.css:

.twoColWrapper{
  display:flex;
  flex-direction: column;
  gap: 32px;
}
.twoColWrapper .imageWrapper, .twoColWrapper .contentWrapper{
  max-width:100%;
  height:auto;
}

@media screen and (min-width:1024px){
  .twoColWrapper{
	flex-direction:row;
  }
}

 

the fields:

Bildschirmfoto 2025-02-12 um 12.32.43.png

 

You can add quite a lot more options to this if you need

 

 

best, 

Anton

Anton Bujanowski Signature
CCioc
Participant

Side-by-Side Image and Text Column in Blog

SOLVE

Awesome dude thank you! Appreciate you including the code, I really don't know how to code well enough for simple things like this. 

kennedyp
Community Manager
Community Manager

Side-by-Side Image and Text Column in Blog

SOLVE

Hi @CCioc! Welcome to the Community-- happy to have you here 😊

 

Can you give some more detail about what blog article template you are using? Any screenshots of the editor would be helpful! Often the formatting of text and images is limited by the template and they are all different! 

 

Best,

Kennedy


Join us on March 27th at 12 PM for the Digital Essentials Lab, an interactive session designed to redefine your digital strategy!
Engage with expert Jourdan Guyton to gain actionable insights, participate in live Q&A, and learn strategies to boost your business success.
Don't miss this opportunity to connect and grow—reserve your spot today!


Did you know that the Community is available in other languages?
Join regional conversations by changing your language settings !
0 Upvotes