How Can I Add Separate Unique Body Class To Label Blogger Blog












1















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"










share|improve this question





























    1















    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"










    share|improve this question



























      1












      1








      1








      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"










      share|improve this question
















      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






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 26 '18 at 2:45









      lagom

      1




      1










      asked Nov 26 '18 at 1:25









      KOD BlogKOD Blog

      61




      61
























          3 Answers
          3






          active

          oldest

          votes


















          0














          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'>






          share|improve this answer


























          • 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



















          0














          <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'/>





          share|improve this answer



















          • 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



















          0














          <body>
          <b:attr name='class'
          value='multiitem'
          cond='data:view.isMultipleItems == &quot;true&quot;'/>
          <b:attr name='class'
          value='homepage'
          cond='data:view.isHomepage == &quot;true&quot;'/>
          <b:attr name='class'
          value='singleitem'
          cond='data:view.isSingleItem == &quot;true&quot;'/>
          <b:attr name='class'
          value='static'
          cond='data:view.isStatic == &quot;true&quot;'/>
          <b:attr name='class'
          value='archive'
          cond='data:view.isArchive == &quot;true&quot;'/>
          <b:attr name='class'
          value='error'
          cond='data:view.isError == &quot;true&quot;'/>
          <b:attr name='class'
          value='post'
          cond='data:view.isPost == &quot;true&quot;'/>
          <b:attr name='class'
          value='page'
          cond='data:view.isPage == &quot;true&quot;'/>





          share|improve this answer























            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
            });


            }
            });














            draft saved

            draft discarded


















            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









            0














            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'>






            share|improve this answer


























            • 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
















            0














            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'>






            share|improve this answer


























            • 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














            0












            0








            0







            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'>






            share|improve this answer















            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'>







            share|improve this answer














            share|improve this answer



            share|improve this answer








            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



















            • 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













            0














            <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'/>





            share|improve this answer



















            • 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
















            0














            <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'/>





            share|improve this answer



















            • 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














            0












            0








            0







            <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'/>





            share|improve this answer













            <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'/>






            share|improve this answer












            share|improve this answer



            share|improve this answer










            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














            • 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











            0














            <body>
            <b:attr name='class'
            value='multiitem'
            cond='data:view.isMultipleItems == &quot;true&quot;'/>
            <b:attr name='class'
            value='homepage'
            cond='data:view.isHomepage == &quot;true&quot;'/>
            <b:attr name='class'
            value='singleitem'
            cond='data:view.isSingleItem == &quot;true&quot;'/>
            <b:attr name='class'
            value='static'
            cond='data:view.isStatic == &quot;true&quot;'/>
            <b:attr name='class'
            value='archive'
            cond='data:view.isArchive == &quot;true&quot;'/>
            <b:attr name='class'
            value='error'
            cond='data:view.isError == &quot;true&quot;'/>
            <b:attr name='class'
            value='post'
            cond='data:view.isPost == &quot;true&quot;'/>
            <b:attr name='class'
            value='page'
            cond='data:view.isPage == &quot;true&quot;'/>





            share|improve this answer




























              0














              <body>
              <b:attr name='class'
              value='multiitem'
              cond='data:view.isMultipleItems == &quot;true&quot;'/>
              <b:attr name='class'
              value='homepage'
              cond='data:view.isHomepage == &quot;true&quot;'/>
              <b:attr name='class'
              value='singleitem'
              cond='data:view.isSingleItem == &quot;true&quot;'/>
              <b:attr name='class'
              value='static'
              cond='data:view.isStatic == &quot;true&quot;'/>
              <b:attr name='class'
              value='archive'
              cond='data:view.isArchive == &quot;true&quot;'/>
              <b:attr name='class'
              value='error'
              cond='data:view.isError == &quot;true&quot;'/>
              <b:attr name='class'
              value='post'
              cond='data:view.isPost == &quot;true&quot;'/>
              <b:attr name='class'
              value='page'
              cond='data:view.isPage == &quot;true&quot;'/>





              share|improve this answer


























                0












                0








                0







                <body>
                <b:attr name='class'
                value='multiitem'
                cond='data:view.isMultipleItems == &quot;true&quot;'/>
                <b:attr name='class'
                value='homepage'
                cond='data:view.isHomepage == &quot;true&quot;'/>
                <b:attr name='class'
                value='singleitem'
                cond='data:view.isSingleItem == &quot;true&quot;'/>
                <b:attr name='class'
                value='static'
                cond='data:view.isStatic == &quot;true&quot;'/>
                <b:attr name='class'
                value='archive'
                cond='data:view.isArchive == &quot;true&quot;'/>
                <b:attr name='class'
                value='error'
                cond='data:view.isError == &quot;true&quot;'/>
                <b:attr name='class'
                value='post'
                cond='data:view.isPost == &quot;true&quot;'/>
                <b:attr name='class'
                value='page'
                cond='data:view.isPage == &quot;true&quot;'/>





                share|improve this answer













                <body>
                <b:attr name='class'
                value='multiitem'
                cond='data:view.isMultipleItems == &quot;true&quot;'/>
                <b:attr name='class'
                value='homepage'
                cond='data:view.isHomepage == &quot;true&quot;'/>
                <b:attr name='class'
                value='singleitem'
                cond='data:view.isSingleItem == &quot;true&quot;'/>
                <b:attr name='class'
                value='static'
                cond='data:view.isStatic == &quot;true&quot;'/>
                <b:attr name='class'
                value='archive'
                cond='data:view.isArchive == &quot;true&quot;'/>
                <b:attr name='class'
                value='error'
                cond='data:view.isError == &quot;true&quot;'/>
                <b:attr name='class'
                value='post'
                cond='data:view.isPost == &quot;true&quot;'/>
                <b:attr name='class'
                value='page'
                cond='data:view.isPage == &quot;true&quot;'/>






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Dec 31 '18 at 4:00









                Minh Quy DesignMinh Quy Design

                11




                11






























                    draft saved

                    draft discarded




















































                    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.




                    draft saved


                    draft discarded














                    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





















































                    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







                    Popular posts from this blog

                    Contact image not getting when fetch all contact list from iPhone by CNContact

                    count number of partitions of a set with n elements into k subsets

                    A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks