Index in a range

I have a row with an img on the first half and some text on the other half. I would like to “flip” the img and the text in every second line but I cant figure out how… could someone help me out?

@dogukan

No need to post images with your code.

To make the code show up in the forum either use the code block button </> or wrap it in backticks.

For reference here is the code snippet you posted before adding the image:

    {{ range $file.items}}
		<div class="row">
			<div class="col-6 mt-5">
				<div class="img-holder text-right">
                        <img src="{{ .img_path }}" class="img-fluid" alt="{{ .title }}">
                </div>
            </div>
			<div class="col-6  mt-5">
				<h2>
					{{ .title }}
				</h2>
				<p class="m-0">
					{{ .content }}
				</p>
				<a href="{{ .button_link }}">
					<button class="normal-button mt-3">{{ .button_text }}</button>
				</a>
			</div>
		</div>
1 Like

Oh ok, i tried but it gave me a kind of weird preview, thats why I deleted it and uploaded a screenshot :sweat_smile:

To flip the img and text on every other row, see the solution in this thread:

1 Like