How Can I Add Separate Unique Body Class To Label Blogger Blog
I want to automatically add unique class names for Homepage and Post page to the <body> tag.
Example:
Show <body class='homepage-page'>
on homepage
Show <body class='post-page label-one'>
on Label "ONE"
Show <body class='post-page label-two'>
on on Label "TWO"
blogger
add a comment |
I want to automatically add unique class names for Homepage and Post page to the <body> tag.
Example:
Show <body class='homepage-page'>
on homepage
Show <body class='post-page label-one'>
on Label "ONE"
Show <body class='post-page label-two'>
on on Label "TWO"
blogger
add a comment |
I want to automatically add unique class names for Homepage and Post page to the <body> tag.
Example:
Show <body class='homepage-page'>
on homepage
Show <body class='post-page label-one'>
on Label "ONE"
Show <body class='post-page label-two'>
on on Label "TWO"
blogger
I want to automatically add unique class names for Homepage and Post page to the <body> tag.
Example:
Show <body class='homepage-page'>
on homepage
Show <body class='post-page label-one'>
on Label "ONE"
Show <body class='post-page label-two'>
on on Label "TWO"
blogger
blogger
edited Nov 26 '18 at 2:45
lagom
1
1
asked Nov 26 '18 at 1:25
KOD BlogKOD Blog
61
61
add a comment |
add a comment |
3 Answers
3
active
oldest
votes
You can use b:class
tag in order to add a class to the parent element.
Not b:class tag directly after <body>
<body>
<b:class cond='data:view.isHomepage' name='homepage-page'/> On homepage
<b:class cond='data:view.isSingleItem and (data:post.labels any (l => l.name == "One"))' name='One'/> On posts pages and label "One"
Note: data:post.labels
works only inside Blog widget <b:widget id='Blog1' type='Blog'>
Cannot if applied to = <html dir='ltr'>
– KOD Blog
Nov 26 '18 at 15:46
It works fine just put b:class tag directly after html tag
– Bassam
Nov 26 '18 at 16:42
<b:class cond='data:view.search.label == "One"' name='One'/> Cannot applied
– KOD Blog
Dec 1 '18 at 11:37
Please show me the result or your complete code. Your code will give a class name "One" with any element, only on pages of label name One
– Bassam
Dec 1 '18 at 12:36
Also make sure you have the label name on your blog.
– Bassam
Dec 1 '18 at 12:43
|
show 5 more comments
<body>
<b:class cond='data:view.isHomepage' name='blog-view-home'/>
<b:class cond='data:view.isPost' name='blog-view-item'/>
<b:class cond='data:view.isPage' name='blog-view-static'/>
<b:class cond='data:view.search.label' name='blog-view-search-label'/>
<b:class cond='data:view.search.query' name='blog-view-search-query'/>
<b:class cond='data:view.search and !data:view.search.label and !data:view.search.query' name='blog-view-search-default'/>
<b:class cond='data:view.isArchive' name='blog-view-archive'/>
<b:class cond='data:view.isError' name='blog-view-error'/>
<b:class cond='data:view.isPreview' name='blog-view-preview'/>
5
While posting an answer it is always recommended to add some description about it, so that the future readers may find this helpful!
– Viira
Dec 31 '18 at 5:56
add a comment |
<body>
<b:attr name='class'
value='multiitem'
cond='data:view.isMultipleItems == "true"'/>
<b:attr name='class'
value='homepage'
cond='data:view.isHomepage == "true"'/>
<b:attr name='class'
value='singleitem'
cond='data:view.isSingleItem == "true"'/>
<b:attr name='class'
value='static'
cond='data:view.isStatic == "true"'/>
<b:attr name='class'
value='archive'
cond='data:view.isArchive == "true"'/>
<b:attr name='class'
value='error'
cond='data:view.isError == "true"'/>
<b:attr name='class'
value='post'
cond='data:view.isPost == "true"'/>
<b:attr name='class'
value='page'
cond='data:view.isPage == "true"'/>
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53473672%2fhow-can-i-add-separate-unique-body-class-to-label-blogger-blog%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
You can use b:class
tag in order to add a class to the parent element.
Not b:class tag directly after <body>
<body>
<b:class cond='data:view.isHomepage' name='homepage-page'/> On homepage
<b:class cond='data:view.isSingleItem and (data:post.labels any (l => l.name == "One"))' name='One'/> On posts pages and label "One"
Note: data:post.labels
works only inside Blog widget <b:widget id='Blog1' type='Blog'>
Cannot if applied to = <html dir='ltr'>
– KOD Blog
Nov 26 '18 at 15:46
It works fine just put b:class tag directly after html tag
– Bassam
Nov 26 '18 at 16:42
<b:class cond='data:view.search.label == "One"' name='One'/> Cannot applied
– KOD Blog
Dec 1 '18 at 11:37
Please show me the result or your complete code. Your code will give a class name "One" with any element, only on pages of label name One
– Bassam
Dec 1 '18 at 12:36
Also make sure you have the label name on your blog.
– Bassam
Dec 1 '18 at 12:43
|
show 5 more comments
You can use b:class
tag in order to add a class to the parent element.
Not b:class tag directly after <body>
<body>
<b:class cond='data:view.isHomepage' name='homepage-page'/> On homepage
<b:class cond='data:view.isSingleItem and (data:post.labels any (l => l.name == "One"))' name='One'/> On posts pages and label "One"
Note: data:post.labels
works only inside Blog widget <b:widget id='Blog1' type='Blog'>
Cannot if applied to = <html dir='ltr'>
– KOD Blog
Nov 26 '18 at 15:46
It works fine just put b:class tag directly after html tag
– Bassam
Nov 26 '18 at 16:42
<b:class cond='data:view.search.label == "One"' name='One'/> Cannot applied
– KOD Blog
Dec 1 '18 at 11:37
Please show me the result or your complete code. Your code will give a class name "One" with any element, only on pages of label name One
– Bassam
Dec 1 '18 at 12:36
Also make sure you have the label name on your blog.
– Bassam
Dec 1 '18 at 12:43
|
show 5 more comments
You can use b:class
tag in order to add a class to the parent element.
Not b:class tag directly after <body>
<body>
<b:class cond='data:view.isHomepage' name='homepage-page'/> On homepage
<b:class cond='data:view.isSingleItem and (data:post.labels any (l => l.name == "One"))' name='One'/> On posts pages and label "One"
Note: data:post.labels
works only inside Blog widget <b:widget id='Blog1' type='Blog'>
You can use b:class
tag in order to add a class to the parent element.
Not b:class tag directly after <body>
<body>
<b:class cond='data:view.isHomepage' name='homepage-page'/> On homepage
<b:class cond='data:view.isSingleItem and (data:post.labels any (l => l.name == "One"))' name='One'/> On posts pages and label "One"
Note: data:post.labels
works only inside Blog widget <b:widget id='Blog1' type='Blog'>
edited Dec 1 '18 at 17:27
answered Nov 26 '18 at 8:43
BassamBassam
1,5692612
1,5692612
Cannot if applied to = <html dir='ltr'>
– KOD Blog
Nov 26 '18 at 15:46
It works fine just put b:class tag directly after html tag
– Bassam
Nov 26 '18 at 16:42
<b:class cond='data:view.search.label == "One"' name='One'/> Cannot applied
– KOD Blog
Dec 1 '18 at 11:37
Please show me the result or your complete code. Your code will give a class name "One" with any element, only on pages of label name One
– Bassam
Dec 1 '18 at 12:36
Also make sure you have the label name on your blog.
– Bassam
Dec 1 '18 at 12:43
|
show 5 more comments
Cannot if applied to = <html dir='ltr'>
– KOD Blog
Nov 26 '18 at 15:46
It works fine just put b:class tag directly after html tag
– Bassam
Nov 26 '18 at 16:42
<b:class cond='data:view.search.label == "One"' name='One'/> Cannot applied
– KOD Blog
Dec 1 '18 at 11:37
Please show me the result or your complete code. Your code will give a class name "One" with any element, only on pages of label name One
– Bassam
Dec 1 '18 at 12:36
Also make sure you have the label name on your blog.
– Bassam
Dec 1 '18 at 12:43
Cannot if applied to = <html dir='ltr'>
– KOD Blog
Nov 26 '18 at 15:46
Cannot if applied to = <html dir='ltr'>
– KOD Blog
Nov 26 '18 at 15:46
It works fine just put b:class tag directly after html tag
– Bassam
Nov 26 '18 at 16:42
It works fine just put b:class tag directly after html tag
– Bassam
Nov 26 '18 at 16:42
<b:class cond='data:view.search.label == "One"' name='One'/> Cannot applied
– KOD Blog
Dec 1 '18 at 11:37
<b:class cond='data:view.search.label == "One"' name='One'/> Cannot applied
– KOD Blog
Dec 1 '18 at 11:37
Please show me the result or your complete code. Your code will give a class name "One" with any element, only on pages of label name One
– Bassam
Dec 1 '18 at 12:36
Please show me the result or your complete code. Your code will give a class name "One" with any element, only on pages of label name One
– Bassam
Dec 1 '18 at 12:36
Also make sure you have the label name on your blog.
– Bassam
Dec 1 '18 at 12:43
Also make sure you have the label name on your blog.
– Bassam
Dec 1 '18 at 12:43
|
show 5 more comments
<body>
<b:class cond='data:view.isHomepage' name='blog-view-home'/>
<b:class cond='data:view.isPost' name='blog-view-item'/>
<b:class cond='data:view.isPage' name='blog-view-static'/>
<b:class cond='data:view.search.label' name='blog-view-search-label'/>
<b:class cond='data:view.search.query' name='blog-view-search-query'/>
<b:class cond='data:view.search and !data:view.search.label and !data:view.search.query' name='blog-view-search-default'/>
<b:class cond='data:view.isArchive' name='blog-view-archive'/>
<b:class cond='data:view.isError' name='blog-view-error'/>
<b:class cond='data:view.isPreview' name='blog-view-preview'/>
5
While posting an answer it is always recommended to add some description about it, so that the future readers may find this helpful!
– Viira
Dec 31 '18 at 5:56
add a comment |
<body>
<b:class cond='data:view.isHomepage' name='blog-view-home'/>
<b:class cond='data:view.isPost' name='blog-view-item'/>
<b:class cond='data:view.isPage' name='blog-view-static'/>
<b:class cond='data:view.search.label' name='blog-view-search-label'/>
<b:class cond='data:view.search.query' name='blog-view-search-query'/>
<b:class cond='data:view.search and !data:view.search.label and !data:view.search.query' name='blog-view-search-default'/>
<b:class cond='data:view.isArchive' name='blog-view-archive'/>
<b:class cond='data:view.isError' name='blog-view-error'/>
<b:class cond='data:view.isPreview' name='blog-view-preview'/>
5
While posting an answer it is always recommended to add some description about it, so that the future readers may find this helpful!
– Viira
Dec 31 '18 at 5:56
add a comment |
<body>
<b:class cond='data:view.isHomepage' name='blog-view-home'/>
<b:class cond='data:view.isPost' name='blog-view-item'/>
<b:class cond='data:view.isPage' name='blog-view-static'/>
<b:class cond='data:view.search.label' name='blog-view-search-label'/>
<b:class cond='data:view.search.query' name='blog-view-search-query'/>
<b:class cond='data:view.search and !data:view.search.label and !data:view.search.query' name='blog-view-search-default'/>
<b:class cond='data:view.isArchive' name='blog-view-archive'/>
<b:class cond='data:view.isError' name='blog-view-error'/>
<b:class cond='data:view.isPreview' name='blog-view-preview'/>
<body>
<b:class cond='data:view.isHomepage' name='blog-view-home'/>
<b:class cond='data:view.isPost' name='blog-view-item'/>
<b:class cond='data:view.isPage' name='blog-view-static'/>
<b:class cond='data:view.search.label' name='blog-view-search-label'/>
<b:class cond='data:view.search.query' name='blog-view-search-query'/>
<b:class cond='data:view.search and !data:view.search.label and !data:view.search.query' name='blog-view-search-default'/>
<b:class cond='data:view.isArchive' name='blog-view-archive'/>
<b:class cond='data:view.isError' name='blog-view-error'/>
<b:class cond='data:view.isPreview' name='blog-view-preview'/>
answered Dec 31 '18 at 3:56
Minh Quy DesignMinh Quy Design
11
11
5
While posting an answer it is always recommended to add some description about it, so that the future readers may find this helpful!
– Viira
Dec 31 '18 at 5:56
add a comment |
5
While posting an answer it is always recommended to add some description about it, so that the future readers may find this helpful!
– Viira
Dec 31 '18 at 5:56
5
5
While posting an answer it is always recommended to add some description about it, so that the future readers may find this helpful!
– Viira
Dec 31 '18 at 5:56
While posting an answer it is always recommended to add some description about it, so that the future readers may find this helpful!
– Viira
Dec 31 '18 at 5:56
add a comment |
<body>
<b:attr name='class'
value='multiitem'
cond='data:view.isMultipleItems == "true"'/>
<b:attr name='class'
value='homepage'
cond='data:view.isHomepage == "true"'/>
<b:attr name='class'
value='singleitem'
cond='data:view.isSingleItem == "true"'/>
<b:attr name='class'
value='static'
cond='data:view.isStatic == "true"'/>
<b:attr name='class'
value='archive'
cond='data:view.isArchive == "true"'/>
<b:attr name='class'
value='error'
cond='data:view.isError == "true"'/>
<b:attr name='class'
value='post'
cond='data:view.isPost == "true"'/>
<b:attr name='class'
value='page'
cond='data:view.isPage == "true"'/>
add a comment |
<body>
<b:attr name='class'
value='multiitem'
cond='data:view.isMultipleItems == "true"'/>
<b:attr name='class'
value='homepage'
cond='data:view.isHomepage == "true"'/>
<b:attr name='class'
value='singleitem'
cond='data:view.isSingleItem == "true"'/>
<b:attr name='class'
value='static'
cond='data:view.isStatic == "true"'/>
<b:attr name='class'
value='archive'
cond='data:view.isArchive == "true"'/>
<b:attr name='class'
value='error'
cond='data:view.isError == "true"'/>
<b:attr name='class'
value='post'
cond='data:view.isPost == "true"'/>
<b:attr name='class'
value='page'
cond='data:view.isPage == "true"'/>
add a comment |
<body>
<b:attr name='class'
value='multiitem'
cond='data:view.isMultipleItems == "true"'/>
<b:attr name='class'
value='homepage'
cond='data:view.isHomepage == "true"'/>
<b:attr name='class'
value='singleitem'
cond='data:view.isSingleItem == "true"'/>
<b:attr name='class'
value='static'
cond='data:view.isStatic == "true"'/>
<b:attr name='class'
value='archive'
cond='data:view.isArchive == "true"'/>
<b:attr name='class'
value='error'
cond='data:view.isError == "true"'/>
<b:attr name='class'
value='post'
cond='data:view.isPost == "true"'/>
<b:attr name='class'
value='page'
cond='data:view.isPage == "true"'/>
<body>
<b:attr name='class'
value='multiitem'
cond='data:view.isMultipleItems == "true"'/>
<b:attr name='class'
value='homepage'
cond='data:view.isHomepage == "true"'/>
<b:attr name='class'
value='singleitem'
cond='data:view.isSingleItem == "true"'/>
<b:attr name='class'
value='static'
cond='data:view.isStatic == "true"'/>
<b:attr name='class'
value='archive'
cond='data:view.isArchive == "true"'/>
<b:attr name='class'
value='error'
cond='data:view.isError == "true"'/>
<b:attr name='class'
value='post'
cond='data:view.isPost == "true"'/>
<b:attr name='class'
value='page'
cond='data:view.isPage == "true"'/>
answered Dec 31 '18 at 4:00
Minh Quy DesignMinh Quy Design
11
11
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53473672%2fhow-can-i-add-separate-unique-body-class-to-label-blogger-blog%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown