# popup for next post

**URL:** <https://community.hubspot.com/t/popup-for-next-post/3269>\
**Category:** CMS Development\
**Created:** [September 8, 2017, 12:07am UTC](https://community.hubspot.com/t/popup-for-next-post/3269 "2017-09-08T00:07:07Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/system/32/124_2.png) [@system](https://community.hubspot.com/u/system)\
**Post date:** [September 8, 2017, 12:07am UTC](https://community.hubspot.com/t/popup-for-next-post/3269/1 "2017-09-08T00:07:07Z")

</div>

Hi,

How can I have

1. related posts at the bottom of blog posts

2. a popup that becomes visible once the user scrolls through the page - with either subscribe button or next read recommendation.

Thanks

---

<div class="post-metadata">

**Author:** ![Jsum](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jsum/32/20405_2.png) [@Jsum](https://community.hubspot.com/u/Jsum)\
**Post date:** [September 8, 2017, 10:17am UTC](https://community.hubspot.com/t/popup-for-next-post/3269/2 "2017-09-08T10:17:38Z")

</div>

[@Gener8](https://community.hubspot.com/t5/user/viewprofilepage/user-id/16810),

As far as setting up your next/previous post, check out the blog section of the [HubL available variables](http://designers.hubspot.com/docs/hubl/hubl-supported-variables):

```auto
{{ content.next_post_name }}
{{ content.next_post_slug }}
{{ content.next_post_featured_image }}

{{ content.previous_post_name }}
{{ content.previous_post_slug }}
{{ content.previous_post_featured_image }}

```

You can use these to construct your next/previous posts:

```auto
{% if content.next_post_slug %}
 <a href="{{ content.next_post_slug }}">
 <h3>{{ content.next_post_name }}</h3>
 <img src="{{ content.next_post_featured_image }}">
 </a>
{% endif %}

{% if content.previous_post_slug %}
 <a href="{{ content.previous_post_slug }}">
 <h3>{{ content.previous_post_name }}</h3>
 <img src="{{ content.previous_post_featured_image }}">
 </a>
{% endif %}

```

if there is a previous or next post then the markup will show. You can manipulate this as needed.

For related posts, related how? by topic? all topics. one topic?

For all topics you will need to loop through your blogs and compare their topics to the current post’s topics. If your only matching one topic you can use this function:

```auto
{% set topic_posts = blog_recent_topic_posts('default', 'marketing-tips', 5) %}
{% for topic_post in topic_posts %}
 <div class="post-title">{{ topic_post.name }}</div>
{% endfor %}

```

where marketing-tips is the topic. You can set this up to a text or choice module value by using export\_to\_template\_context.

That’s all the HubL you need. The rest of your question is javascript.

Does this section popup or does it become visible on scroll? these things are different. If it is popup then you will want to look for popup scripts, of you just want it to become visible on scroll then checkout waypoint.js.

---

<div class="post-metadata">

**Author:** ![rickbyrd](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/rickbyrd/32/52876_2.png) [@rickbyrd](https://community.hubspot.com/u/rickbyrd)\
**Post date:** [November 29, 2017, 7:03pm UTC](https://community.hubspot.com/t/popup-for-next-post/3269/3 "2017-11-29T19:03:39Z")

</div>

Jsum,

The code you shared for “Popular Posts” does not have clickable text. How would you make the text clickable?

I tried using

{% set pop\_posts = blog\_popular\_posts(‘default’, 3, ‘finance’) %}  
{% for pop\_post in pop\_posts %}  
\<a class=“post-title” href={{ pop\_post.name }}\>{{pop\_post.name}}\</a\>  
{% endfor %}

The text is clickable but now they and not is a stacked list view but they are listed with a comma between each post name.

You can see it in action here: [5 Tips for Paying Back a Personal Installment Loan](https://www.bigpictureloans.com/blog/tips-paying-back-personal-loan)

Thanks!

---

<div class="post-metadata">

**Author:** ![Jsum](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jsum/32/20405_2.png) [@Jsum](https://community.hubspot.com/u/Jsum)\
**Post date:** [November 30, 2017, 6:10am UTC](https://community.hubspot.com/t/popup-for-next-post/3269/4 "2017-11-30T06:10:19Z")

</div>

Well first your missing your quotations around the href value.  
Second, if .name outputs the post name and an href expects a url… .name wont work. I would consider trying a token that outputs a url like .absolute\_url if that is the correct syntax. All variables can be found in the variable section of the hubl docs. Dont forget your quotations.

---

<div class="post-metadata">

**Author:** ![rickbyrd](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/rickbyrd/32/52876_2.png) [@rickbyrd](https://community.hubspot.com/u/rickbyrd)\
**Post date:** [November 30, 2017, 12:04pm UTC](https://community.hubspot.com/t/popup-for-next-post/3269/5 "2017-11-30T12:04:49Z")

</div>

Thanks so much. I can’t believe I missed that. That works!
