# Exclude latest post from range

**URL:** <https://discourse.gohugo.io/t/exclude-latest-post-from-range/44205>\
**Category:** support\
**Tags:** pagination\
**Created:** [May 3, 2023, 9:05pm UTC](https://discourse.gohugo.io/t/exclude-latest-post-from-range/44205 "2023-05-03T21:05:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Amjad\_Ali](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/amjad_ali/32/19370_2.png) [@Amjad\_Ali](https://discourse.gohugo.io/u/Amjad_Ali)\
**Post date:** [May 3, 2023, 9:05pm UTC](https://discourse.gohugo.io/t/exclude-latest-post-from-range/44205/1 "2023-05-03T21:05:53Z")

</div>

Displaying one latest post

```auto
{{ $blogs := site.GetPage "/blog/" }}
                {{ range first 1 $blogs.Pages }}
{{end}}

```

====

And on same page showing all blog post using pagination

```auto
 {{ $paginator := .Paginate (where .Site.RegularPages "Section" "blog") }}

                        {{ range $paginator.Pages }}
 {{end}}

```

===  
Issue is latest post is also included in second query I want to exclude latest post

in this `{{ $paginator := .Paginate (where .Site.RegularPages "Section" "blog") }}` range

---

<div class="post-metadata">

**Author:** ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)\
**Post date:** [May 4, 2023, 2:19am UTC](https://discourse.gohugo.io/t/exclude-latest-post-from-range/44205/2 "2023-05-04T02:19:45Z")

</div>

```html
{{ $p := where site.RegularPages.ByDate.Reverse "Section" "blog" }}

<h2>The latest</h2>
{{ with index $p 0 }}
  <h3><a href="{{ .RelPermalink }}">{{ .Title }}</a></h3>
{{ end }}

<h2>The others</h2>
{{ range (.Paginate ($p | after 1)).Pages }}
  <h3><a href="{{ .RelPermalink }}">{{ .Title }}</a></h3>
{{ end }}
{{ template "_internal/pagination.html" . }}

```

---

<div class="post-metadata">

**Author:** ![Amjad\_Ali](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/amjad_ali/32/19370_2.png) [@Amjad\_Ali](https://discourse.gohugo.io/u/Amjad_Ali)\
**Post date:** [May 4, 2023, 2:19pm UTC](https://discourse.gohugo.io/t/exclude-latest-post-from-range/44205/3 "2023-05-04T14:19:47Z")

</div>

Prefect. thanks this worked

---

<div class="post-metadata">

**Author:** ![system](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/system/32/1_2.png) [@system](https://discourse.gohugo.io/u/system)\
**Post date:** [May 6, 2023, 2:20pm UTC](https://discourse.gohugo.io/t/exclude-latest-post-from-range/44205/4 "2023-05-06T14:20:00Z")

</div>

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.
