Latest news, food, business, travel, sport, Tips and Tricks...

Blogger snippet Operator

Snippet operator in Blogger is used to make excerpt or post summary. It can cut the maximum character in the Text such as article body based on parameter used by this operator.

Blogger Excerpt Operator [snippet]

STRING snippet {PARAMETERS:VALUE}

The Parameter for [snippet] Operator

These are parameter for snippet operator, used multiple parameter must be separated by a comma. When parameter is not present in the settings, default value will be taken.

ParameterValueDefault ValueMeaning
lengthnumber50The x* number length of the summary. Has Minimum 50 character and Maximum 1000 character.
linebreakstrue | falsetruePreserve or Discard Line Break in the target block of string if any.
linksPreserve or Discard Links present in the target block of string if any.
ellipsisAdds three dots ... in the end of summary.

Blogger Excerpt Operator [snippet] Example

<b:eval expr='data:post.body

       snippet { 

         length: 150,

         links: false,

         linebreaks: false }'/>

Try to add above code right under <b:includable id='post' var='post'>. With this evaluation, we create post summary with 150 character length, if there any link present, it will be treated like normal word, and if there is any line break in the block of string we targeted such as <br /> it will be removed. Three dots will be there in the end of 150 character that we set on the length, even we not adds ellipsis parameter since the default value is 'true'.

Creating Post Summary with snippet Operator

There are several Blogger data expression to create post summary.

data:post.body

This is the post body part or article of our post. If we use this as summary, it contains basic word formatting, such as BOLD or ITALIC. Has Maximum 1000 character from post body.

data:post.longSnippet

Same as above but All character treated as normal character, no BOLD, ITALIC, Link, Line Break.

data:post.snippets.long

Same as above but only work for Layout Version 3 with widget version 2.

,

No comments:

Post a Comment