{{ blog_post }}

blog_post Properties

FieldTypeDescription
object_typestring"blog_post"
is_validTrue|FalseTrue if this references a blog_post or false if the blog_post is null
guidguidThe unique identifier for this blog_post
blog_guidtext_field
blogblog
image_guidtext_field
imageimage
summary_htmlhtml_field
content_htmlhtml_field
post_datedatetime_field
nametext_fieldThe entity name. This field is primarily intended for internal use by website administrators to identify objects.
titletext_field
linked_titlehtmlA link to the blog_post if it has a URL, or the escaped title if not.
folder_guidtext_field
folderfolder
has_urlboolean
site_domain_guidtext_field
ssl_modetext_field
include_in_searchboolean
urltext_field
template_guidtext_field
templatetemplate
canonical_urlurl_field
browser_titletext_field
meta_descriptiontextarea_field
meta_robotstextarea_field
keywordstextarea_field
full_urlstringThe full URL of the page - including the scheme ("http://", "https://" or just "//"), the domain name, and the path.
visitedtrue/falseWhether or not the user has visited the blog_post before in their current session. Note that this will always be false if the user has not allowed session permission (see the Permissions and Personalization documentation).
customvariesEach blog_post includes all of the custom properties defined by the template.
tagstagsThe list of tags associated with this blog_post.
authorsauthorsThe list of authors associated with this blog_post.
valuestringSynonymn for guid
outputhtmlThe default output that the blog_post produces when output directly to the template.
output_in_listhtmlThe default output that the blog_post produces when output directly to the template as part of a list.

blog_posts Summary

Contains multiple blog_posts.

blog_posts Properties

FieldTypeDescription
object_typestring"blog_posts"
is_validtrue/falsetrue if this contains at least one blog_post
prependedlist of blog_postsblog_posts that will be listed at the beginning of the items list
fetchedlist of blog_postsThe primary list of blog_posts to be included in the items list
appendedlist of blog_postsblog_posts that will be listed at the end of the items list
appended_uniquelist of blog_postsblog_posts that will be listed at the end of the items list, excluding any blog_posts that are already included in either the prepended or fetched lists
itemslist of blog_postsThe full list of blog_posts in the proper order and uniqueness, including prepended, fetched, and appended blog_posts
sizenumberThe total number of items in the list of items, including prepended, fetched, and appended blog_posts
limitnumberThe maximum number of blog_posts that could have been fetched dynamically from the database
startnumberThe 1-based index of the first blog_post that was (or would have been) dynamically fetched from the database
pagenumberThe 1-based index of the first "page" of blog_posts that could have been fetched dynamically from the database - as determined by the start and limit properties
total_countnumberThe total number of blog_posts in the database that matched the provided filter parameters when fetching the list of fetched blog_posts
total_pagesnumberThe total number of "pages" of results that matched the provided filter parameters when fetching the list of fetched blog_posts - as determined by the total_count and limit properties
outputhtmlThe default output that the blog_posts will produce when it is output directly to the template - using the "output_in_list" property of each blog_post in the items list

Examples

Getting request parameters and fetching blog_posts

Copy
{% assign var postsPerPage = 10 %} {% assign pageParam = 1 %} {% if request.query_params['page'] %} {% assign pageParam = request.query_params['page'] | to_int %} {% endif %} {% if request.query_params['tag'] and request.query_params['tag'] != "" %} {% assign tagFilter = request.query_params['tag'] | url_decode | downcase %} {% endif %} {% blog_posts assign posts = blog:"The Kitchen Essentials" tag:tagFilter limit:postsPerPage page:pageParam sort_by:"post_date" sort_direction:"desc" %} {% for post in posts %} {{post.title}} {% endfor %}

Methods

{% blog_post %}

Fetch a single blog_post.

{% blog_post
[var|set|assign] new_variable_name
Specify a variable name in order to save the blog_post to a variable. If not specified the blog_post will be output to the template instead. The variable will be saved using the "var" behavior unless "set" or "assign" are specified.
output_to_template
If included, the blog_post will be output directly to the template.
=
blog_post|guid|string
%}

{% blog_posts %}

Fetch a list of blog_posts.

{% blog_posts
[var|set|assign] new_variable_name
Specify a variable name in order to save the results to a variable. If not specified the results will be output to the template instead. The variable will be saved using the "var" behavior unless "set" or "assign" are specified.
output_to_template
If included, the results will be output directly to the template.
=
prepend:blog_post|blog_posts|guid|string
Prepend the specified blog_posts before the fetched results. All prepended input will be returned in the same order that it is input.
append:blog_post|blog_posts|guid|string
Append the specified blog_posts after the fetched results. All appended input will be returned in the same order that it is input.
exclude:blog_post|blog_posts|guid|string
Prevent the specified blog_posts from being included in the fetched results. Has no affect on prepended and appended blog_posts
exclude_prepended:true
Specifically exclude all prepended blog_posts from the fetched results. If "unique:true" is specified this is the default behavior, although you may also specify "exclude_prepended:false" to allow any prepended items to be fetched along with other results anyway.
exclude_appended:true
Specifically exclude all appended blog_posts from the fetched results. This is false by default - even if "unique:true" is specified - so that results are returned in the proper order.
unique:true
If set to true, each of the resulting lists (prepended, fetched, appended, and items) will be unique, although there may be duplicates between the prepended, fetched, and appended lists. The "items" list will include objects in the order in which they appear - with prepended items first, then fetched items, then appended items.
max_size:25
If specified, then the "items" list will only include up to the specified number of blog_posts. The "limit" may be automatically lowered to only fetch the maximum number of blog_posts that will be included in "items" following prepended items. Note that this may also impact both the "page and "total_pages" values. In order to use pagination with a list loaded using "max_size" use "start" instead of "page" and "limit".
filter:string
Only return blog posts that match the given string filter
has_url:boolean
Filter results to only return blog posts for which has_url exactly matches the specified value.
blog:blog|blogs|guid|string
Only return blog posts with one of these blogs
start_date:datetime
Filter results to return blog posts for which post_date is greater than or equal to start_date.
end_date:datetime
Filter results to return blog posts for which post_date is less than or equal to end_date.
template:template|templates|guid|string
Only return blog posts with one of these templates
include_in_search:boolean
Filter results to only return blog posts for which include_in_search exactly matches the specified value.
site_domain_guid:guid
Filter results to only return blog posts for which site_domain_guid exactly matches the specified value.
ssl_mode:string
Filter results to only return blog posts for which ssl_mode exactly matches the specified value.
tag:tag|tags|guid|string
Only return blog posts with one of these tags
author:author|authors|guid|string
Only return blog posts with one of these authors
folder:folder|folders|guid|string
Only return blog posts with one of these folders
date_created_start:datetime
Filter results to return blog posts for which date_created is greater than or equal to date_created_start.
date_created_end:datetime
Filter results to return blog posts for which date_created is less than or equal to date_created_end.
start:1
Set the 1-based index of the first blog_post to fetch.
page:1
Automatically calculate the first blog_post to fetch based on both of the "limit" and the 1-based "page" value. Ignored if "start" is set.
limit:25
Defines the maximum number of blog_posts to be fetched. If not included, this will default to 10. Note that if "max_size" is specified then "limit" may be automatically lowered even if specified.
sort_by:"date_created"
Specify which field to sort the fetched results by. Has no affect on prepended or appended blog_posts.
By default results will be sorted by relevance if there is a filter string and date_created (the date the item was first published) desc (newest first) if not.
Other Options include:
  • PostDate
  • Name
  • Title
  • URL
  • BrowserTitle
  • relevance (based on which field matches the given filter and where in the field the match is found. When sorting by relevance sort_direction is irrelevant)
  • date_created (Equivalent to the date you first published this item. Unpublishing and republishing the item resets date_created to the current date)
  • random (By default using random sorting prevents fast caching of the page. Setting "cache_random:true" overrides this behavior and allows the page to be fast-cached anyway)
sort_direction:"desc"
Specify whether the fetched results should be sorted in asc (ascending) or desc (descending) order.
%}

If you do not include any filters or inputs other than prepended items, appended items, or max_size, then no additional items will be fetched. If you wish to fetch all items you must include at least one additional input (ie: "start:1")