do-community / developer-glossary

A community-built glossary of technical terms.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

BUG: Letter of alphabet shows up before each consecutive term with the same first letter

ruf-io opened this issue · comments

We've finally added more than one term starting with the same letter and it exposed a bug:

image

The letter C is only meant to show up before the FIRST term beginning with C

This code is not doing what it is intended to:

{{ if or (eq $index 0) (ne $letter (substr .Title 0 1)) }}
{{ $letter := (substr .Title 0 1) }}
<h2 class="text-center">{{ $letter }}</h2>
<hr>
{{ end }}

Update the logic to correct, BTW here is a useful discussion of a similar problem: https://discourse.gohugo.io/t/lists-of-content-divided-by-posts-first-letter/8534

I can take a look at this for you, can you assign me?

Sorry for the delay, working on it now.