# Link field \> Publish status?

**URL:** <https://community.hubspot.com/t/link-field-publish-status/89252>\
**Category:** CMS Development\
**Created:** [September 8, 2023, 1:30pm UTC](https://community.hubspot.com/t/link-field-publish-status/89252 "2023-09-08T13:30:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![TMerkel](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/tmerkel/32/33545_2.png) [@TMerkel](https://community.hubspot.com/u/TMerkel)\
**Post date:** [September 8, 2023, 1:30pm UTC](https://community.hubspot.com/t/link-field-publish-status/89252/1 "2023-09-08T13:30:55Z")

</div>

Hi everyone,

while using the link field in a custom module, I’ve just realized that it is possible for Editors to choose from all existing pages/blog posts without checking the **publication status**.

That results in 404 errors because people can choose unpublished pages, and pages that will be unpublished in the future won’t be removed automatically.

Any quick and easy solution for it? 🙂

Thanks

---

<div class="post-metadata">

**Author:** ![ModuleMaestro](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/modulemaestro/32/32546_2.png) [@ModuleMaestro](https://community.hubspot.com/u/ModuleMaestro)\
**Post date:** [September 10, 2023, 2:11am UTC](https://community.hubspot.com/t/link-field-publish-status/89252/2 "2023-09-10T02:11:05Z")

</div>

Hi @TMerkel,

As you’ve surfaced it seems the page module field allows selection of pages that aren’t published. In terms of solutions for this I’m not seeing any options for us to pass validation in the field selection. I did however manage to retrieve a page’s publish status through the use of the **content\_by\_id** module function [here](https://developers.hubspot.com/docs/cms/hubl/functions#content-by-id).

The HubL I used was as follows:

```lia-code-sample
{% set page_id = module.page_field %}
{% set page_content = content_by_id(page_id) %}

{{ page_content.isPublished }} ->> will return false or true depending on whether it's published

```

And returned a value of **false** when the page wasn’t published. I’m thinking you could use this as a way to surface up a warning in the editor screen (not the module editor sidebar) that the page is not published when someone selects an unpublished page. Past this, I think it would be a good feature request to allow some further validations to this particular field to avoid user error when selecting pages.

Hope this helps!

---

<div class="post-metadata">

**Author:** ![TMerkel](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/tmerkel/32/33545_2.png) [@TMerkel](https://community.hubspot.com/u/TMerkel)\
**Post date:** [September 12, 2023, 7:00am UTC](https://community.hubspot.com/t/link-field-publish-status/89252/3 "2023-09-12T07:00:24Z")

</div>

Thanks! That helps to hide pages from showing up in an unpublished status on the page itself.

Now i need to check, how to show a info message while editing pages 🙂
