# Set page status to hidden based on other page and site parameters

**URL:** <https://discourse.gohugo.io/t/set-page-status-to-hidden-based-on-other-page-and-site-parameters/23678>\
**Category:** support\
**Created:** [February 26, 2020, 2:29pm UTC](https://discourse.gohugo.io/t/set-page-status-to-hidden-based-on-other-page-and-site-parameters/23678 "2020-02-26T14:29:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![fekete-robert](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/fekete-robert/32/13363_2.png) [@fekete-robert](https://discourse.gohugo.io/u/fekete-robert)\
**Post date:** [February 26, 2020, 2:29pm UTC](https://discourse.gohugo.io/t/set-page-status-to-hidden-based-on-other-page-and-site-parameters/23678/1 "2020-02-26T14:29:28Z")

</div>

Hi, I am fairly new to Hugo, and would like to know if the following is possible.  
We are using Hugo for product documentation, and sometimes the documentation page of a feature is already available, but I would like to exclude it from publishing.

The idea is to set a parameter on the page frontmatter (for example, available\_from\_version: 4.1), and to set the current version number in the config.toml of the site. Then during buildtime a partial template or similar could compare the two version numbers, and include the page in the build if the current\_version\_number is greater than or equal to the available\_from\_version parameter set in the page.  
Is it possible to do that? So far I couldn’t get the page excluded from the sidebar menus and such.

(I would like to avoid manually setting the publishdate or draft status of these pages, as it is rather error-prone and easy to forget.)

Thanks for your help in advance!

---

<div class="post-metadata">

**Author:** ![maiki](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/maiki/32/16384_2.png) [@maiki](https://discourse.gohugo.io/u/maiki)\
**Post date:** [February 26, 2020, 6:39pm UTC](https://discourse.gohugo.io/t/set-page-status-to-hidden-based-on-other-page-and-site-parameters/23678/2 "2020-02-26T18:39:10Z")

</div>

> [@fekete-robert](#):
>
> (I would like to avoid manually setting the publishdate or draft status of these pages, as it is rather error-prone and easy to forget.)

I don’t know how to do what you want off the top of my head, but I disagree: setting a version number versus “draft: false” or omitting the draft front matter all together, seems about the same.

```auto
title: Example Docs
available_from_version: 4.1
draft: false

```

🤔

> [@fekete-robert](#):
>
> Is it possible to do that? So far I couldn’t get the page excluded from the sidebar menus and such.

If you are using Hugo’s menu system, you can use your version number idea to conditionally load the menu items. 🙂

---

<div class="post-metadata">

**Author:** ![fekete-robert](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/fekete-robert/32/13363_2.png) [@fekete-robert](https://discourse.gohugo.io/u/fekete-robert)\
**Post date:** [February 28, 2020, 8:35am UTC](https://discourse.gohugo.io/t/set-page-status-to-hidden-based-on-other-page-and-site-parameters/23678/3 "2020-02-28T08:35:22Z")

</div>

Hi maiki,  
Thanks a lot for the tip, I’ll look into the menu and see how we are using it.  
The actual condition to decide when to include/exclude pages is a bit more complex, so I’d definitely want to avoid manually setting the draft parameter. But if it can’t be done from hugo, we’ll use a script instead 🙂
