Add blog tag URL's and limit post summary characters in JS callback for recent blog posts
SOLVE
Hello! I am trying to get the url's for the blog tags added into the JS callback for recent blog posts. I would also like to truncate the summary post characters and am having issues getting both of these to work. I am using this code
Add blog tag URL's and limit post summary characters in JS callback for recent blog posts
SOLVE
Hi jwill377!
Nice to meet you, Tomas Gaitan, Technical Implementation Specialist at HAL Company, HubSpot Diamond Partner.
To add the blog tag URLs, you can modify the formatting variable inside the loop to include an anchor tag for each tag. Here is an example of how you can modify the code:
In this modified code, we are using map() to create an anchor tag for each tag in the tagList, and using the url property of each tag to create the href attribute of the anchor tag. We are also adding a class="blog-tag" to the anchor tag so you can style it as needed.
To truncate the characters in the post summary, we will use the substring() method to get the first 100 characters of the postSummary property and add an ellipsis at the end. You can adjust the number of characters as needed.
I remain attentive to any questions or queries you may have.
Add blog tag URL's and limit post summary characters in JS callback for recent blog posts
SOLVE
Hi jwill377!
Nice to meet you, Tomas Gaitan, Technical Implementation Specialist at HAL Company, HubSpot Diamond Partner.
To add the blog tag URLs, you can modify the formatting variable inside the loop to include an anchor tag for each tag. Here is an example of how you can modify the code:
In this modified code, we are using map() to create an anchor tag for each tag in the tagList, and using the url property of each tag to create the href attribute of the anchor tag. We are also adding a class="blog-tag" to the anchor tag so you can style it as needed.
To truncate the characters in the post summary, we will use the substring() method to get the first 100 characters of the postSummary property and add an ellipsis at the end. You can adjust the number of characters as needed.
I remain attentive to any questions or queries you may have.
Add blog tag URL's and limit post summary characters in JS callback for recent blog posts
SOLVE
Hello! Thank you for your response, it was very helpful. The code is returning all the correct tags associated with the post, however, it seems that the URL for the tags (links to the tag detail pages) is returning "undefined".