# Page fields do not work well

**URL:** <https://community.hubspot.com/t/page-fields-do-not-work-well/120796>\
**Category:** CMS Development\
**Created:** [November 19, 2024, 4:19am UTC](https://community.hubspot.com/t/page-fields-do-not-work-well/120796 "2024-11-19T04:19:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![TMisuna](https://avatars.discourse-cdn.com/v4/letter/t/e9bcb4/32.png) [@TMisuna](https://community.hubspot.com/u/TMisuna)\
**Post date:** [November 19, 2024, 4:19am UTC](https://community.hubspot.com/t/page-fields-do-not-work-well/120796/1 "2024-11-19T04:19:28Z")

</div>

The “page fields” that I have set up in the module are not working properly, and the website pages called up are sometimes displayed and sometimes not, even though I have indeed set them up.

**■My creation flow**  
1. I create an original module and prepare “page field”. The website page set here is selected and displayed on the front end.

2. I want to enable multiple selection of page fields. Therefore, the “page field” will be repetitive.

3. Put the item to be looped in the “content\_by\_id” function as an argument.

4. Output the looped content as a li tag and call absolute\_url, page\_title and meta\_description.

**■Problem**  
The website pages set in the “module.seminar\_page\_select” page field may or may not be displayed.

For example, only 2 pages appear on the actual front end, even though I have indeed set 4 in the page edit screen.

This is also true in the editor during editing, and the behavior is unstable. I think there were a few times when it worked.

For example, if I set 3 items, there were times when 3 items appeared.

The “module.library\_page\_select” is a page field with the same mechanism, but the display here is normal.

Rather, when “module.library\_page\_select” is updated, the above bug seems to occur more often.

It may be that something is interfering or overriding each other.

This is a mystery, but the JSON information for the pages set in “module.library\_page\_select” does indeed store 3 items.

However, only the first two are actually displayed. In other words, the following “178222335333” is not displayed.

“seminar\_page\_select”: [  
181559445858,  
182462472079,  
178222335333  
],

**■Source code in question**

```lia-code-sample
<ul>
 <li>
 {% if module.library_page_select %}
 <ul>
 {% for library_item in module.library_page_select %}
 {% set library_content = content_by_id(library_item) %}
 {% if library_content %}
 <li>
 <a href="{{ library_content.absolute_url }}">
 <h3>{{ library_content.page_title }}</h3>
 <p>{{ library_content.meta_description }}</p>
 </a>
 </li>
 {% endif %}
 {% endfor %}
 </ul>
 {% endif %}
 </li>

 <li>
 {% if module.seminar_page_select %}
 <ul>
 {% for seminar_item in module.seminar_page_select %}
 {% set seminar_content = content_by_id(seminar_item) %}
 {% if seminar_content %}
 <li>
 <a href="{{ seminar_content.absolute_url }}">
 <h3>{{ seminar_content.page_title }}</h3>
 <p>{{ seminar_content.meta_description }}</p>
 </a>
 </li>
 {% endif %}
 {% endfor %}
 </ul>
 {% endif %}
 </li>
</ul>

```

**■Cause?**  
I thought it might be due to the fact that the pages were drafts, not published, but they all had a published status. So the status of the page does not seem to be the cause.

Is something overwriting the page? The one that does not display well is the “seminar\_page\_select” one. There is no case that “library\_page\_select” was not displayed, but when “library\_page\_select” is updated, the articles in “seminar\_page\_select” disappear. (e.g. there should have been 3 articles in the front end, but there are now 2 articles).

This may be because the for loop is not working properly.

---

<div class="post-metadata">

**Author:** ![Berangere](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/berangere/32/220784_2.png) [@Berangere](https://community.hubspot.com/u/Berangere)\
**Post date:** [November 19, 2024, 5:03pm UTC](https://community.hubspot.com/t/page-fields-do-not-work-well/120796/2 "2024-11-19T17:03:46Z")

</div>

Hi @TMisuna, I hope that you are well!  
Thanks for sharing the code and for asking the Community!  
I’d love to put you in touch with our Top Experts: Hi @Bortami, @JTBuys and @Stephanie-OG do you have suggestions to help @TMisuna, please?  
Thanks so much and have a lovely day!  
Best,  
Bérangère

---

<div class="post-metadata">

**Author:** ![TMisuna](https://avatars.discourse-cdn.com/v4/letter/t/e9bcb4/32.png) [@TMisuna](https://community.hubspot.com/u/TMisuna)\
**Post date:** [November 20, 2024, 12:49am UTC](https://community.hubspot.com/t/page-fields-do-not-work-well/120796/3 "2024-11-20T00:49:40Z")

</div>

Mrs. BérangèreL.

Thank you. I’m trying to approach this problem, but if it doesn’t work, I’d like to take another approach that doesn’t use the page field.

I think the Hubl function “blog\_recent\_posts” can output blogs, but is it possible to get specific website pages (not blogs)?

For example, getting the 5 most recent website pages with the slug /casestudy/.
