# Retrieve and show data from a blog post URL using custom module

**URL:** <https://community.hubspot.com/t/retrieve-and-show-data-from-a-blog-post-url-using-custom-module/27542>\
**Category:** CMS Development\
**Created:** [November 3, 2020, 1:23pm UTC](https://community.hubspot.com/t/retrieve-and-show-data-from-a-blog-post-url-using-custom-module/27542 "2020-11-03T13:23:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![shiyon](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/shiyon/32/99782_2.png) [@shiyon](https://community.hubspot.com/u/shiyon)\
**Post date:** [November 3, 2020, 1:23pm UTC](https://community.hubspot.com/t/retrieve-and-show-data-from-a-blog-post-url-using-custom-module/27542/1 "2020-11-03T13:23:00Z")

</div>

Hi,

Please check the attached image. I’ve created a custom module using the below code to show 2 recent posts from a blog inside a website page. But our new requirement is to show same data from some posts which we input manually. So is it possible to fetch Feature image, Title and Content from a specific blog post URL? It is ok if we need to repeat the custom module twice inside the template.

{% set rec\_posts = blog\_recent\_posts(‘default’, 2) %}  
\<div class=“row-fluid-wrapper”\>  
\<div class=“row-fluid”\>

{% for rec\_post in rec\_posts %}  
\<div class=“span12”\>  
\<a href=“{{rec\_post.absolute\_url}}” class=“blog-post”\>  
\<div class=“span6”\>  
\<div class=“blog-img-outer”\>  
\<img src=“{{ rec\_post.post\_list\_summary\_featured\_image }}” alt=“{{ rec\_post.featured\_image\_alt\_text }}”\>  
\</div\>  
\</div\>  
\<div class=“span6”\>  
\<h3\>{{ rec\_post.name }}\</h3\>  
\<h3\>{{ rec\_post.show\_date }}\</h3\>  
\<p\>  
{{ rec\_post.post\_summary|striptags|truncate(150,false,‘…’) }}  
\</p\>  
\<span class=“read-more”\>Read More\</span\>  
\</div\>  
\</a\>  
\</div\>

{% endfor %}  
\</div\>  
\</div\>

Thanks

Shiyon

 ![33807iF0671D17BBDB093C.jpg](https://d2qpr2jzcazej7.cloudfront.net/original/3X/8/f/8f74d7d254d4c41b6e02fe86e3e5686276148931.jpeg)

---

<div class="post-metadata">

**Author:** ![alyssamwilie](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/alyssamwilie/32/2072_2.png) [@alyssamwilie](https://community.hubspot.com/u/alyssamwilie)\
**Post date:** [November 3, 2020, 10:19pm UTC](https://community.hubspot.com/t/retrieve-and-show-data-from-a-blog-post-url-using-custom-module/27542/2 "2020-11-03T22:19:14Z")

</div>

Hey @shiyon ,  
I don’t believe you can fetch a blog by it’s URL, but you could use the content\_by\_id function to grab a post by it’s ID number. The ID number can be found in the page editor URL of a post.

![33823i172CD53C5E646408.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/3/6/36a8dbd5992fbfadb2554067d42ee0d6b309f571.png)

But so the user doesn’t have to go find the ID you could use the Page field in a custom module to grab that:

 ![33824i1B74E27DCACA9EC9.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/d/4/d40b958fa7b53a6a0721c0aabf634abc22fe7373.png)

```lia-code-sample
<div class="row-fluid-wrapper">
 <div class="row-fluid">
 {% for postID in module.page_field %}
 {% set post = content_by_id(postID) %}

 <div class="span12">
 <a href="{{post.absolute_url}}" class="blog-post">
 <div class="span6">
 <div class="blog-img-outer">
 <img src="{{ post.post_list_summary_featured_image }}" alt="{{ post.featured_image_alt_text }}">
 </div>
 </div>

 <div class="span6">
 <h3>{{ post.name }}</h3>
 <h3>{{ post.publish_date }}</h3>
 <p>
 {{ post.post_summary|striptags|truncate(150,false,'...') }}
 </p>
 <span class="read-more">Read More</span>
 </div>
 </a>
 </div>
 {% endfor %}
 </div>
</div>

```

---

<div class="post-metadata">

**Author:** ![shiyon](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/shiyon/32/99782_2.png) [@shiyon](https://community.hubspot.com/u/shiyon)\
**Post date:** [November 4, 2020, 9:39am UTC](https://community.hubspot.com/t/retrieve-and-show-data-from-a-blog-post-url-using-custom-module/27542/3 "2020-11-04T09:39:41Z")

</div>

Thank you very much @alyssamwilie! You’ve explain it well also. This was exactly what I wanted.
