The related_blog_posts HubL tag can be used to create dynamic and related blog post listing based on a variety of parameters. It allows for generating listings of posts across blogs, with the ability to filter by tags, authors, post paths and publish dates.
related_blog_posts
HubL tag does not generate an editable module on the post/page level, it is configured in its entirety with HubL.post_formatter
parameter allows you to specify a macro to generate the HTML output of the module. For a full list of parameters and example default HTML output, please see the related_blog_posts spec.
Parameter | Type | Description | Default |
---|---|---|---|
limit | number | The max number of blog posts to list. | 3 |
blog_ids | ’default’ or blog id | The ID(s) of a blogs to include posts from. | none |
tags | String | The tag(s) that should be used to determine if a post is relevant (comma separated). If a blog post has one of these tags or a similar tag, the post’s relevancy is increased, improving its ranking in the listing. | none |
blog_authors | String | The names of authors to include posts from (comma separated) | none |
blog_post_ids | String | The ID(s) of a blog posts to use when finding relevant blog posts to list (comma separated). This parameter should only be used when the widget is appearing on pages, as on blog posts, it will default to the post the widget is appearing on. | none |
post_formatter | String | The name of a custom macro to render returned blog posts. The macro is passed three parameters which are the blog post object to format, the count in the iteration of blog posts, and the total count of blog posts in the results. If not specified or set to “default”, the built-in formatter will be used to format each post. Note: It is recommended to use the callback parameter below in place of the ‘post_formatter’ parameter as the HTML of the tag will render more quickly, decreasing page load times. | none |
callback | String | The name of a javascript function to render returned blog posts. The function is passed an array of blog post objects to format. If neither the callback, or post_formatter parameters are specified, the tag will generate HTML in a default format. | none |
path_prefixes | String | URL paths or subdirectories to include posts from (comma separated). If a blog post has a similar prefix in its path, the post’s relevancy is increased, improving its ranking in the listing. | none |
start_date | date/time | Allows for filtering of posts published after a date/time. | none |
end_date | Date/Time | Allows for filtering of posts published before a date/time. | False |
blog_post_override | String | The ID(s) of a blog posts which should always show up in the returned listing, despite all other parameter values and filters (comma separated). | none |
callback
parameter instead of the post_formatter
parameter to ensure faster page load times.related_blog_posts
HubL tag is being used on a post, the blog_post_ids
parameter should not be specified, as on blog posts, it will default to the post the widget is appearing on.blog_authors
across two different blogs.
blog_post_ids
parameter, so it would be used on a page.
callback
parameter to control the HTML output of the post listing. (Instead of the post_formatter
parameter using a macro.)