Skip to main content

How to Highlight Author Comments in Blogger Posts

In this Blogger tutorial I will show you how to highlight the author comments section of your Blogger template (Blogspot template) using CSS styling.

Benefits of Adding CSS Styling to Author Comments
If you are using a default Blogger template chances are it is difficult to differentiate between comments made by visitors and comments made by you, the blog author. If you only have a few comments per post that may not be enough of an issue for you. If however, you have some posts with lots of comments you may need to make your remarks stand out from those of your visitors. We can do that by adding CSS styling to highlight your author comments.

What Will I Learn in This Tutorial?
In this Blogger tutorial you will learn how to easily add some highlighting to your comments so that they will never get lost in the crowd again. This requires a small amount of tweaking to your Blogger template which is not difficult to do if care is taken. The image below shows one example of what can be achieved using this Blogger hack and some CSS styling.



Will This Blogger Hack Work on My Template?
I have tested this Blogger hack on both the old generation of Blogger templates (Minima and Sand Dollar) and the latest generation of default Blogger templates eg Simple. It will also work on custom templates as the comments code is likely to be very similar.

If you are using a custom Blogger template and run into difficulty you can also try this alternative method to highlight author comments in Blogger posts

How to Add CSS Styling to Author Comments in a Blogger Post
The following instructions will highlight author comments in the comments section of a Blogger post. The code creates a shaded box around the comments made by the blog author. These changes will not affect the CSS the styling of any of the other comments made.

Instructions to Add CSS Highlighting to Author Comments in Blogger

  1. Login to Blogger

  2. From the Dashboard go to Design > Edit HTML

  3. Back up your template by downloading it to your computer

  4. Check the Expand Widget Templates checkbox on the top righthand side

  5. Use CTRL + F by entering the following into the search box

    <dd class='comment-body'>

  6. Immediately above this line paste the following code:

    <b:if cond='data:comment.author == data:post.author'>
    <dd class='comment-body-author'>
    <p><data:comment.body/></p>
    </dd>
    <b:else/>

  7. Now look for this code block

    <dd class='comment-body'>
    <b:if cond='data:comment.isDeleted'>
    <span class='deleted-comment'><data:comment.body/></span>
    <b:else/>
    <p><data:comment.body/></p>
    </b:if>
    </dd>

    and paste </b:if> immediately after it.

  8. Your code will now look like this:

    <div expr:id='data:widget.instanceId + &quot;_comments-block-wrapper&quot;'>
    <dl expr:class='data:post.avatarIndentClass' id='comments-block'>
    <b:loop values='data:post.comments' var='comment'>
    <dt expr:class='&quot;comment-author &quot; + data:comment.authorClass' expr:id='data:comment.anchorName'>
    <b:if cond='data:comment.favicon'>
    <img expr:src='data:comment.favicon' height='16px' style='margin-bottom:-2px;' width='16px'/>
    </b:if>
    <a expr:name='data:comment.anchorName'/>
    <b:if cond='data:blog.enabledCommentProfileImages'>
    <data:comment.authorAvatarImage/>
    </b:if>
    <b:if cond='data:comment.authorUrl'>
    <a expr:href='data:comment.authorUrl' rel='nofollow'><data:comment.author/></a>
    <b:else/>
    <data:comment.author/>
    </b:if>
    <data:commentPostedByMsg/>
    </dt>


    <b:if cond='data:comment.author == data:post.author'>
    <dd class='comment-body-author'>
    <p><data:comment.body/></p>
    </dd>
    <b:else/>


    <dd class='comment-body' expr:id='data:widget.instanceId + data:comment.cmtBodyIdPostfix'>
    <b:if cond='data:comment.isDeleted'>
    <span class='deleted-comment'><data:comment.body/></span>
    <b:else/>
    <p>
    <data:comment.body/>
    </p>
    </b:if>
    </dd>

    </b:if>

    </dd>
    <dd class='comment-footer'>
    <span class='comment-timestamp'>
    <a expr:href='data:comment.url' title='comment permalink'>
    <data:comment.timestamp/>
    </a>
    <b:include data='comment' name='commentDeleteIcon'/>
    </span>
    </dd>
    </b:loop>
    </dl>
    </div>

  9. Now using CTRL + F again find this line ]]></b:skin>

  10. Paste the following immediately before ]]></b:skin>

    .comment-body-author {
    background: #f5deb3;
    border: 2px solid #de7008;
    padding: 5px;
    }

  11. Save your template changes

  12. Click on View Blog and go to a post that you have commented on to see the CSS styling has highlighted your comments.


Alternative Method to Add Highlighting to Author Comments in Blogger
The following method will also add highlighting to author comments in Blogger and can be used if you have difficulty with the first method. It does however involve changing some code rather than just adding some so this is not as desirable in terms of future proofing your template for Blogger updates.



  1. Login to Blogger

  2. From the Dashboard go to Design > Edit HTML

  3. Back up your template by downloading it to your computer

  4. Check the Expand Widget Templates checkbox on the top righthand side

  5. Find the following section of code by using CTRL + F and entering <data:comment.body/> into the search box

    <span class='deleted-comment'><data:comment.body/></span>
    <b:else/>
    <p><data:comment.body/></p>
    <b:include data='comment' name='commentDeleteIcon'/>
    </b:if>

  6. Replace with the following code after <span class='deleted-comment'> and before </b:if> as shown in red:

    <span class='deleted-comment'>
    <!--Highlight Author Comments Start-->
    <b:if cond='data:comment.author == data:post.author'>
    <p class='comment-body-author'><data:comment.body/></p>
    <b:else/>
    <p><data:comment.body/></p>
    </b:if>
    <!--Highlight Author Comments End-->

    </b:if>

  7. Use CTRL + F to find ]]></b:skin> that closes the CSS styling section

  8. Paste the following code immediately above ]]></b:skin>

    p.comment-body-author {
    background: #eeeecc;
    border: 2px solid #335577;
    padding: 5px;
    color:#558866;
    }

  9. Save your template

  10. Click on View Blog and navigate to a post that you have commented on to see the that your comments will now be highlighted


In this Blogger tutorial you have learned two different methods to add CSS styling to highlight the author comments in your Blogger posts. Obviously there is still some work to do on your part to adjust the colors in the CSS styling to match the color scheme of your blog. Good luck!


Related Articles
List of Blog Know How Tutorials for Blogger Blogs
Embedding a Comment Form Below Each Post
How to Get More Comments on Your Blogger Blog
Add Missing Embedded Comment Form to Blogger

Comments

Popular posts from this blog

How to Add a Subtitle to Blogger Posts

This Blogger tutorial shows you how to easily and quickly add a subtitle to your Blogger posts (Blogspot posts) so that both search engines and readers will have more information about your post. I also discuss the benefits of adding subtitles to Blogger articles. This is an easy tweak to your Blogger blog that anyone can carry out in a couple of minutes. Benefits of Using Subtitles in Posts Adding a subtitle which appears below the title of your post can be both eye catching and informative. For instance a titling schema for this post could be: Title: Add a Subtitle to a Blogger Blog Subtitle: Make Your Posts More Search Engine Friendly and User Friendly If you craft your titles and subtitles carefully you will encourage more targeted readers of your blog as they will be able to see at a glance what your post is about rather than reading the whole article. Your traffic therefore might be slightly less but they will be far more targeted to the content of your site resulting in a

Cara Membuat Blog Sendiri

Cara Membuat Blog Sendiri Menjadi seorang blogger artinya menjadi penulis dan webmaster. Sebagaimana sebagai penulis buku, artikel koran atau hanya sebuah blog inilah Tips Trik Membuat blog dan menjaga semangat ngeblog agar kontinyu. Karena ternyata, ngeblog itu meletihkan dan melelahkan. Perlu enerji cukup, terutama asupan ke otak dan mata. Karena pekerjaan otak ternyata lebih berat dan lebih melelahkan daripada fisik. 1. Bawa Buku Catatan kecil atau Notes kemana pergi. Ketika muncul ide atau ilham jangan tunda, langsung tulis. Kalau ditunda akan lupa. Bukan mudah mau memanggil ingatan yang sudah lewat/lupa. 2. Sewaktu mendapat ide atau ilham tulis Ide Utamanya . Kemudian jabarkan menjadi poin-poin kecil. 3. Ketika online, atau siap menulis artikel, susun sebaik mungkin. Suatu saat kita boleh saja membuat update/perubahan. Namun jangan mengira kita bisa selalu membuat perubahan. Jadi, buatlah artikel sebaik-baiknya sebelum dipublish atau diposting. 4. Buatlah arti

Panjang Maksimum Deskripsi Video Youtube dan Pesan Kesalahan

Ada banyak diskusi di sekitar tentang menambahkan Caption teks ke deskripsi video YouTube Anda. YouTube secara otomatis akan mengkonversi konten audio dari streaming video Anda ke teks biasa - sehingga dapat digunakan untuk teks tertutup. Anda tentu saja harus cek dan edit ini sebagai hasil yang sedikit aneh dari waktu ke waktu! Anda kemudian dapat menambahkan teks keterangan ini untuk deskripsi video YouTube Anda. Sehingga akan diindeks juga oleh mesin pencari. Masalahnya adalah bahwa itu sangat mudah untuk menemukan kesalahan pada YouTube di mana dikatakan bahwa pengaturan video Anda tidak bisa diselamatkan alasan adalah bahwa baik deskripsi terlalu panjang atau berisi karakter ILLEGAL.  Ini adalah pesan kesalahan yang sangat tidak membantu. Oke. YouTube Anda memberitahu bahwa deskripsi terlalu panjang? Atau apakah itu mengandung karakter ilegal? Atau keduanya? Setelah mengalami masalah ini beberapa kali, saya mengatur tentang bereksperimen dan melihat apa yang sejauh deskrip