# Equivalent code to ifchanged Django template tag

**URL:** <https://discourse.gohugo.io/t/equivalent-code-to-ifchanged-django-template-tag/24458>\
**Category:** support\
**Created:** [April 4, 2020, 4:22pm UTC](https://discourse.gohugo.io/t/equivalent-code-to-ifchanged-django-template-tag/24458 "2020-04-04T16:22:17Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![hypertexthero](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/hypertexthero/32/20609_2.png) [@hypertexthero](https://discourse.gohugo.io/u/hypertexthero)\
**Post date:** [April 7, 2020, 3:04pm UTC](https://discourse.gohugo.io/t/equivalent-code-to-ifchanged-django-template-tag/24458/4 "2020-04-07T15:04:00Z")

</div>

Thanks, @divinerites — your solution worked, but what I really needed was a little bit different from my question, and I only realized it after further thought; What I wanted was the equivalent of Django’s `{% if not forloop.first %}` [template tag](https://docs.djangoproject.com/en/3.0/ref/templates/builtins/) — a way to **skip the first item in a range** , specifically so that a date line would only appear _after_ the first post in a list.

This is the solution that worked for me, with help from [this post](https://discourse.gohugo.io/t/how-counting-up-a-variable-in-range/586/8):

```auto
{{ $.Scratch.Set "counter" 0 }}
{{ range .Site.RegularPages.GroupByDate "Monday, 2 January 2006" }}
  {{ $.Scratch.Set "counter" (add ($.Scratch.Get "counter") 1) }}    
  {{ if ne ($.Scratch.Get "counter") 1 }}
    <h2 class="dateline">{{ .Key }}</h2>
  {{ end }}
    …display articles, etc…
{{ end }}

```

Thanks for your help!

---

_[View the full topic](https://discourse.gohugo.io/t/equivalent-code-to-ifchanged-django-template-tag/24458)._
