Configure Post Comments and Date
Configure Post Comments & Date
While writing a code for a Custom Blogger Template there should be Cheat sheet of some xml codes to make workflow faster than fast.
Syntax Code for Comments
Below the code to configure comments is provided but the styling is on you. Explanation of the code is also provided below.
<b:if cond='data:post.numberOfComments gt 0 and data:jwidget.allBylineItems.comments'>
<small>
<data:post.numberOfComments/>
</small>
</b:if>
Demo
Preveiw:
6
Explaination
-
<b:if>: This is a conditional tag in Blogger's template language. It checks a specified condition and executes the contained content (inside the<b:if>block) if the condition is true. -
cond='data:post.numberOfComments gt 0 and data:jwidget.allBylineItems.comments': This is the condition being checked. It consists of two parts joined by the logical "and" operator (and). Let's break down each part:-
data:post.numberOfComments gt 0: This part checks whether the number of comments on the current post (data:post.numberOfComments) is greater than 0. It's using the greater than (gt) operator. -
data:jwidget.allBylineItems.comments: This part appears to be checking the presence of a widget or data related to comments in the byline items. Without more context, it's challenging to precisely explain this part.
-
-
<small><data:post.numberOfComments/></small>: If the condition is true, the content inside the<b:if>block is executed. In this case, it outputs the number of comments for the current post wrapped in a<small>HTML tag. The value is obtained using thedata:post.numberOfCommentsvariable.
Syntax Code for Post Date
<b:if cond='data:jwidget.allBylineItems.timestamp'> <small> <span expr:data-date='data:post.date.iso8601'> <b:eval expr='data:jwidget.allBylineItems.timestamp.label ? data:post.date format data:jwidget.allBylineItems.timestamp.label : data:post.date'/> </span> </small> </b:if>
Demo
Preveiw:
30 Dec, 2021
Explaination
-
<b:if cond='data:jwidget.allBylineItems.timestamp'>: This is a conditional statement that checks whetherdata:jwidget.allBylineItems.timestampis defined or has a truthy value. If it evaluates to true, the content inside the<b:if>block will be executed. -
<span class='date-format' expr:data-date='data:post.date.iso8601'>: This begins a<span>HTML tag with a class attribute set to 'date-format'. It also has an expression (expr:data-date) that seems to set the data attributedata-dateto the ISO 8601 formatted date of the current post (data:post.date.iso8601). -
<b:eval expr='data:jwidget.allBylineItems.timestamp.label ? data:post.date format data:jwidget.allBylineItems.timestamp.label : data:post.date'/>: This is an evaluation statement that uses the<b:eval>tag to conditionally format the date. It checks ifdata:jwidget.allBylineItems.timestamp.labelis defined, and if true, it formats the date using the specified label. If not defined, it falls back to formatting the date using the default format (data:post.date). -
</span></small>: This closes the<span>and<small>tags.
data:jwidget.allBylineItems.timestamp
is defined. If true, it outputs a formatted date inside a <small>
tag. The date formatting is conditional based on the
presence of data:jwidget.allBylineItems.timestamp.label. If the label is defined, it uses that label for formatting; otherwise, it
uses the default date format.
Ask your Query Here
ReplyDeleteOK
DeleteHello
ReplyDeletecan you sell your register and login script?
ReplyDeleteComing soon...
Delete