# Excluding current page when using 'shuffle\`

**URL:** <https://discourse.gohugo.io/t/excluding-current-page-when-using-shuffle/51265>\
**Category:** support\
**Created:** [August 22, 2024, 6:46pm UTC](https://discourse.gohugo.io/t/excluding-current-page-when-using-shuffle/51265 "2024-08-22T18:46:52Z")\
**Posts on this page:** 1\
**Showing post:** 4

<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:** [August 23, 2024, 1:10am UTC](https://discourse.gohugo.io/t/excluding-current-page-when-using-shuffle/51265/4 "2024-08-23T01:10:09Z")

</div>

This is a bit cleaner, and you will always list 8 pages.

In your original code you would list either 7 or 8, depending on whether the current page is in the first 8 after shuffling.

> **layouts/\_default/single.html**
>
> ```plaintext
> {{ define "main" }}
> <h1>{{ .Title }}</h1>
> {{ .Content }}
> 
> {{ range site.RegularPages | complement (slice .) | shuffle | first 8 }}
> <a href="{{ .RelPermalink }}">{{ .Title }}</a>
> {{ end }}
> 
> {{ end }}
> 
> ```

---

_[View the full topic](https://discourse.gohugo.io/t/excluding-current-page-when-using-shuffle/51265)._
