[Solved] Hugo Breadcrumbs add incremented integer

Hi There

I am currently using:

{{ $url := replace .Permalink ( printf "%s" .Site.BaseURL) "" }}
{{ $.Scratch.Add "path" .Site.BaseURL }}
<ol class="breadcrumbs">
  <li><a href="/">home</a></li>
  {{ range $index, $element := split $url "/" }}
    {{ $.Scratch.Add "path" $element }}
      {{ if ne $element "" }}
      <li><a href='{{ $.Scratch.Get "path" }}'>{{ . }}</a></li>
      {{ $.Scratch.Add "path" "/" }}
      {{ end }}
  {{ end }}
</ol>

To create my breadcrumbs. However, I want to change it to allow for Microdata. For this I need to add:

<meta itemprop="position" content="1">

In every li element.

Where the content=“1” is an integer that increases with each addition to the list.

Using the above code, is there a way to make that happen?

inside the range,

<meta itemprop="position" content="{{ $index }}">

Ok, that works but it starts at 0. Is there a way to start it at 1?

Edit: Found the solution:

{{ add $index 1 }}

Add [Solved] to title of the post :wink:

Will do.