The latest tips and news from the Blogger team
Adding new expressions to Blogger templates
May 22, 2015
Blogger's template engine is powered by a flexible editing language, consisting of
a set of Widget Tags
which use expressions to conditionally change the output HTML for each post and page on your blog.
Using these expressions, you can customize the HTML output of your blog, to adjust the look and feel. You could, for example, show an image behind the header, but only on the homepage. Or add a flower icon, next to a post's title, if the post has the 'Flower' label.
You can customize your blog's template under
Settings > Template > Edit HTML.
You can customize your template’s markup, to change the look and feel of your blog.
Previously, the expressions in Blogger's templates could
Add or concatenate values with
+
Subtract values with
-
Check for equality with
!=
and
==
Compare values with
<
,
>
,
<=
and
>=
Now, support has been added for many more expression operators, including:
Inversion of true/false values with
!/not
e.g.
<b:if
cond=
'!data:post.allowComments'
>
...
Picking between 2 values with
?:
e.g.
<a
expr:class=
'data:post.allowComments ? "comments" : "no-comments"'
...
Checking if a value is a member of a set or array, with
in/contains
e.g.
<b:if
cond=
'data:blog.pageType in {"index", "archive"}'
>...
Combining multiple conditions with
and/or
e.g.
<b:if
cond=
'data:blog.pageType == "index" and data:post.allowComments'
>...
Changing the order of operations with
()
e.g.
<div
expr:style=
'"max-width: " + (data:width + 10) + "px;"'
>...
For a full specification of the new operators, see
the help article
.
Happy Templating!
Posted by Luke Bjerring, Software Engineer
Labels
+1
3
10th Birthday
13
2010
1
accessibility
1
ads
1
adsense
7
Amazon
1
Android
2
Blog2Print
1
Blogger
26
Blogger birthday
1
Blogger Fiesta
2
Blogger Meetup
2
Blogger Stats
2
Blogger Template Designer
1
Blogger2Print
1
blogspot
2
BlogThis
1
blogworld
2
Buzz
1
calendar
1
Chrome
2
code
1
commenting
2
community
8
conference
2
custom domain
1
developers
2
DMCA
1
draft
1
dynamic views
5
events
2
feedburner
2
feeds
1
firefox
1
follow by email
1
following
2
foxytunes
1
FTP
1
gadgets
10
GAN
3
Google Analytics
1
Google Buzz
1
Google Sites
1
google+
10
grandcentral
1
help
2
ios
1
jump
1
knol
1
lightbox
1
mobile
5
monetize
3
music
1
navbar
2
New UI
4
next blog
1
OneTrueFan
1
openid
1
OpenSky
1
Page Creator
1
pages
1
pixelodeon
1
polls
1
post summaries
1
read more
1
recommend
1
SEO
2
Share
3
support
1
SXSW
1
template designer
2
twitter
1
video
2
videoblogging
1
Viglink
1
web fonts
1
webcall
1
youtube
3
zemanta
1
Archive
2020
May
2019
Jan
2018
May
2017
Mar
2016
Nov
May
Apr
Mar
2015
Dec
Sep
Jun
May
Jan
2014
Feb
2013
Dec
Sep
Aug
Jun
Apr
2012
Dec
Nov
Oct
Sep
Aug
Jul
Jun
May
Apr
Mar
Feb
Jan
2011
Dec
Nov
Oct
Sep
Aug
Jul
Jun
May
Apr
Mar
Feb
Jan
2010
Dec
Nov
Oct
Sep
Aug
Jul
Jun
May
Apr
Mar
Feb
Jan
2009
Dec
Nov
Oct
Sep
Aug
Jul
Jun
May
Apr
Mar
Feb
Jan
2008
Dec
Nov
Oct
Sep
Aug
Jul
Jun
May
Apr
Mar
Feb
Jan
2007
Dec
Nov
Oct
Sep
Aug
Jul
Jun
May
Apr
Mar
Feb
Jan
2006
Dec
Nov
Oct
Sep
Aug
Jul
Jun
May
Apr
Mar
Feb
Jan
2005
Dec
Nov
Oct
Sep
Aug
Jul
Jun
May
Apr
Mar
Feed