# randomize blogs on webpage

**URL:** <https://community.hubspot.com/t/randomize-blogs-on-webpage/122910>\
**Category:** Blog, Website & Page Publishing\
**Tags:** starter\
**Created:** [December 20, 2024, 7:49pm UTC](https://community.hubspot.com/t/randomize-blogs-on-webpage/122910 "2024-12-20T19:49:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![JReyes65](https://avatars.discourse-cdn.com/v4/letter/j/e47c2d/32.png) [@JReyes65](https://community.hubspot.com/u/JReyes65)\
**Post date:** [December 20, 2024, 7:49pm UTC](https://community.hubspot.com/t/randomize-blogs-on-webpage/122910/1 "2024-12-20T19:49:49Z")

</div>

Hello,

I am still rather new at this and appreciate everyone patience, but is there a way to have more blogs show on the webpage or have them be randomized as opposed to being shown by publishing date?

Thank you,

Justin

---

<div class="post-metadata">

**Author:** ![Jigar\_Thakker](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jigar_thakker/32/63606_2.png) [@Jigar\_Thakker](https://community.hubspot.com/u/Jigar_Thakker)\
**Post date:** [December 23, 2024, 8:29am UTC](https://community.hubspot.com/t/randomize-blogs-on-webpage/122910/2 "2024-12-23T08:29:38Z")

</div>

Hi @JReyes65 ,

To display more blog posts on your HubSpot webpage, access the post filter module where your blog posts are shown. Select the blog you want to display posts from, and in the module settings, adjust the maximum number of posts to display by entering your desired number. If left blank, all posts will be shown. Additionally, you can specify a text link, such as “See all,” to appear when there are more posts than the set limit. These settings give you control over the number of blog posts displayed to your viewers.

HubSpot’s Design Manager doesn’t offer a native option to randomize blog posts, but you can try using custom code or a script to manipulate the DOM and reorder the blog post elements randomly.

For your reference:

> **[Use default modules in the layout editor](https://knowledge.hubspot.com/design-manager/use-default-modules-in-the-layout-editor)**
>
> This article explains the different modules you can add to a drag and drop template in the layout editor within Design Manager.

If this helps, feel free to mark it as the solution ✔ and give it an upvote 👍 !

---

<div class="post-metadata">

**Author:** ![GiantFocal](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/giantfocal/32/41969_2.png) [@GiantFocal](https://community.hubspot.com/u/GiantFocal)\
**Post date:** [December 23, 2024, 11:27am UTC](https://community.hubspot.com/t/randomize-blogs-on-webpage/122910/3 "2024-12-23T11:27:53Z")

</div>

Hi @JReyes65,

This is possible. The simplest way to randomize blog posts in HubSpot is by using the shuffle hubL filter in the blog posts fetch hubL. Here’s how to implement it:

First, fetch your blog posts using either blog\_recent\_posts() or blog\_popular\_posts() function. For example:

`{% set articles = blog_recent_posts("default", 30) %}​`

You’ll need to call more posts than the posts to display on the page.

Then, use the shuffle filter while looping through the posts:

```lia-code-sample
{% for article in articles|shuffle %}
 <a href="{{ article.absolute_url }}">{{ article.name }}</a>
{% endfor %}​

```

Finally, limit the number of random posts displayed, you can use the loop.index condition:

```lia-code-sample
{% for article in articles|shuffle %}
 {% if loop.index <= 3 %}
 <a href="{{ article.absolute_url }}">{{ article.name }}</a>
 {% endif %}
{% endfor %}

```

For example, this will show only 3 random posts from the 30 posts fetched in step #1.
