Blogger Theme: View Data

I thought that it would be useful to compile Blogger Theme template view data here as I am always asked via email by my followers & blog subscribers on other options that Blogger provides in customizing their blog template views.


These view data sets is available in any Blogger theme. At a Blogger page > Right Click > select Inspect > scroll to the very bottom of view-source under _WidgetManager._SetDataContext() Blogger settings objects.

Behavior


Available globally in Theme > Edit HTML. Some data view object values depends on the availability of Mobile Template view settings at Theme > Mobile Template > Settings.

These data view objects also combines Dynamic Theme template settings when it is enabled/used.

{
  'name': 'view',
  'data': 
  {
    'isMobile': boolean, 
    'title': text, /* blog page title */
    'description': text, /* blog page search description */
    'featuredImage': url, /* fully qualified post image URL */
    'url': url, /* fully qualified blog page canonical URL */
    'type': pageType, /* item, index, static_page etc */
    'isSingleItem': boolean, 
    'isMultipleItems': boolean, 
    'isError': boolean, 
    'isPage': boolean, 
    'isPost': boolean, 
    'isHomepage': boolean, 
    'isArchive': boolean, 
    'isLabelSearch': boolean, 
    'postId': integer, /* blog post id */
    'isPreview': boolean,
    'isMultipleItems' : boolean,
    'isSingleItem' : boolean,
    'isArchive' : boolean,
    'isLabelSearch' : boolean,
    'isSearch' : boolean,
    'isLabelSearch' : boolean 
  }
}

How to use on Blogger Theme > Edit HTML


These data view can be used with any Blogger expression tags. Example usages :-

<!-- check title data availability in view data object -->
<b:if cond='data:view.title'>

  <!-- print out the title data values with a <h1/> tag --> 
  <h1><data:view.title /></h1>

</b:if>

Example Output 


A blog page title with an <h1> tag.

Resources


  1. Widget Tags for Layout - Blogger Help Articles
  2. Adding new expressions to Blogger templates - Official Blogger Blog


Notes


If I have left something out or possible new updates by Blogger Team, please leave a comment below.

1 comment:

  1. For the first time I have changed the theme that are meant to be the part of the using this phone. It has been so interesting and new for me to change the theme whenever I want to.

    ReplyDelete

Insert search keyword(s) & press enter...

 
Our website development is made possible by displaying online advertisements.
Please consider supporting us & our projects by disabling your Ad Blocker. Thank You.
Our website requires javascripts turned on for best user experience.
Please consider to turn on your web browser javascript. Thank You.
GDPR: Data submitted at our site is managed by 3rd party processors. Read more on how data is collected, managed & processed at our site. Learn More