# Link to page not working

**URL:** <https://community.hubspot.com/t/link-to-page-not-working/10698>\
**Category:** CMS Development\
**Created:** [October 24, 2018, 9:43am UTC](https://community.hubspot.com/t/link-to-page-not-working/10698 "2018-10-24T09:43:04Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jedthehumanoid](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jedthehumanoid/32/88643_2.png) [@jedthehumanoid](https://community.hubspot.com/u/jedthehumanoid)\
**Post date:** [October 24, 2018, 9:43am UTC](https://community.hubspot.com/t/link-to-page-not-working/10698/1 "2018-10-24T09:43:04Z")

</div>

Hi there. I’m new to hubl and the design manager. I’ve created a module and I’m trying to link to a page using the (Page) field, but it’s not working. It should be really simple but I don’t know where I’m going wrong. Can someone help? He is my code:

```auto
{% set pageURL = page_by_id(item.recentpost_link) %}

<section class="home-posts">
 <div class="container recent-posts">
 <h1 class="underline">{{ module.title_intro.title }}</h1>
 <p class="posts-intro">{{ module.title_intro.introduction }}</p>
 <div class="recent-posts__cntr">
 {% for item in module.info_card %}
 	<div class="card">
 	<div class="card __image__ holder">
 <a href="{{ pageURL }}">
 	<div class="card__image" style="background-image:url('{{ item.image.src }}');"></div>
 </a>
 	</div>
 <div class="card__text">
 <h3><a href="{{ pageURL }}">{{ item.title }}</a></h3>
 <p>{{ item.descriptive_text }}</p>
 </div>
 		</div>
 {% endfor %}
 </div>
 </div>
</section>

```

in the page itself I can select a page successfully, but when I publish it and look at the code there is no link.

```auto
<div class="card">
 	<div class="card __image__ holder">
 <a href="">
 	<div class="card__image" style="background-image:url('https://cdn2.hubspot.net/hubfs/4552700/Piston.jpg?t=1540212077293');"></div>
 </a>
 	</div>
 <div class="card__text">
 <h3><a href="">This is the title of post 2</a></h3>
 <p>This is the default text here. Replace it with something interesting!</p>
 </div>
 		</div>

```

Any ideas? Thanks in advance!

---

<div class="post-metadata">

**Author:** ![jedthehumanoid](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jedthehumanoid/32/88643_2.png) [@jedthehumanoid](https://community.hubspot.com/u/jedthehumanoid)\
**Post date:** [October 24, 2018, 9:57am UTC](https://community.hubspot.com/t/link-to-page-not-working/10698/2 "2018-10-24T09:57:06Z")

</div>

My other question is, why can’t I link to a blog post? So if i go to select a page I can see all pages but blog posts. is there a way to include these too. For example, I want to show a list of the blog posts on my home page, but I don’t want to use the RSS module. Thanks

---

<div class="post-metadata">

**Author:** ![jedthehumanoid](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jedthehumanoid/32/88643_2.png) [@jedthehumanoid](https://community.hubspot.com/u/jedthehumanoid)\
**Post date:** [October 24, 2018, 1:03pm UTC](https://community.hubspot.com/t/link-to-page-not-working/10698/3 "2018-10-24T13:03:31Z")

</div>

Managed to fix this myself

```auto
<section class="home-posts">
 <div class="container recent-posts">
 <h1 class="underline">{{ module.title_intro.title }}</h1>
 <p class="posts-intro">{{ module.title_intro.introduction }}</p>
 <div class="recent-posts__cntr">
 {% for item in module.info_card %}
 	<div class="card">
 	<div class="card __image__ holder">
 <a href="{{ page_by_id(item.page_link).absolute_url }}">
 	<div class="card__image" style="background-image:url('{{ item.image.src }}');"></div>
 </a>
 	</div>
 <div class="card__text">
 <h3><a href="{{ page_by_id(item.page_link).absolute_url }}">{{ item.title }}</a></h3>
 <p>{{ item.descriptive_text }}</p>
 </div>
 		</div>
 {% endfor %}
 </div>
 </div>
</section>

```

---

<div class="post-metadata">

**Author:** ![Jenny](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jenny/32/24_2.png) [@Jenny](https://community.hubspot.com/u/Jenny)\
**Post date:** [October 25, 2018, 10:38pm UTC](https://community.hubspot.com/t/link-to-page-not-working/10698/4 "2018-10-25T22:38:37Z")

</div>

Thanks for sharing your solution @jedthehumanoid!
