***
Theo mặc định khi ta thêm Widget /Gadget vào blogspot của mình thì chúng được hiển thị ở mọi trang và mọi bài viết . Tuy vậy với hướng dẫn hôm nay , mình sẽ chia sẻ cách làm sao cho nó xuất hiện ở những trang , những chỗ nào mình dùng đến ..
Bây giờ bắt tay vào thao tác trên ví dụ mình nhá?
-Bước đầu tiên bao giờ cũng là : đăng nhập vào blogspot => Mẫu => Chỉnh sửa HTML
-Bước 2 : Trong mục Chuyển tới tiện ích hãy chọn popular post hay Widget mà bạn cần chỉnh sửa
-Bước 3: Kích vào mũi tên đầu dòng để mở code của tiện ích đó.
Bây giờ là việc chỉnh sửa đoạn code đó cho phù hợp với việc nó xuất hiện ở đâu:
Trong hướng dẫn này mình tùy chỉnh tiện ích id =HTML3
Code sau khi mở mũi tên đầu dòng thường có dạng như bên dưới
<b:widget id='HTML3' locked='false' title='' type='HTML'>
<b:includable id='main'>
<!-- only display title if it's non-empty -->
<b:if cond='data:title != ""'>
<h2 class='title'><data:title/></h2>
</b:if>
<div class='widget-content'>
<data:content/>
</div>
<b:include name='quickedit'/>
</b:includable>
</b:widget>
<b:includable id='main'>
<!-- only display title if it's non-empty -->
<b:if cond='data:title != ""'>
<h2 class='title'><data:title/></h2>
</b:if>
<div class='widget-content'>
<data:content/>
</div>
<b:include name='quickedit'/>
</b:includable>
</b:widget>
Và bây giờ tùy vào mục đích bạn thêm đúng theo mẫu sau (thêm những đoạn code được tô đỏ ) :
- Chỉ cho phép widget hiển thị ở trang chủ
<b:widget id='HTML3' locked='false' title='' type='HTML'>
<b:includable id='main'>
<b:if cond='data:blog.url == data:blog.homepageUrl'>
<!-- only display title if it's non-empty -->
<b:if cond='data:title != ""'>
<h2 class='title'><data:title/></h2>
</b:if>
<div class='widget-content'>
<data:content/>
</div>
<b:include name='quickedit'/>
</b:if>
</b:includable></b:widget> - Chỉ cho phép widget hiển thị ở từng bài viết:
<b:widget id='HTML3' locked='false' title='' type='HTML'>
<b:includable id='main'>
<b:if cond='data:blog.pageType == "item"'>
<!-- only display title if it's non-empty -->
<b:if cond='data:title != ""'>
<h2 class='title'><data:title/></h2>
</b:if>
<div class='widget-content'>
<data:content/>
</div>
<b:include name='quickedit'/>
</b:if>
</b:includable></b:widget> - Chỉ cho phép widget hiển thị ở những trang nhất định:
<b:widget id='HTML3' locked='false' title='' type='HTML'>
<b:includable id='main'>
<b:if cond='data:blog.url == "Link trang đó của bạn"'>
<!-- only display title if it's non-empty -->
<b:if cond='data:title != ""'>
<h2 class='title'><data:title/></h2>
</b:if>
<div class='widget-content'>
<data:content/>
</div>
<b:include name='quickedit'/>
</b:if>
</b:includable></b:widget> - Hiển thị ở trang label nhất định
<b:widget id='HTML4' locked='false' title='test 1' type='HTML'>
<b:includable id='main'>
<b:if cond='data:blog.url == "http://sinhvienviet360.blogspot.com/search/label/thủ thuật"'>
<!-- only display title if it's non-empty -->
<b:if cond='data:title != ""'>
<h2 class='title'><data:title/></h2>
</b:if>
<div class='widget-content'>
<data:content/>
</div>
<b:include name='quickedit'/>
</b:if>
</b:includable>
</b:widget>
Với cách hướng dẫn trên bạn có thể tùy chỉnh theo mục đích của blogspot của bạn ..
Chúc các bạn thành công !!
ABOUT THE AUTHOR

Hello We are OddThemes, Our name came from the fact that we are UNIQUE. We specialize in designing premium looking fully customizable highly responsive blogger templates. We at OddThemes do carry a philosophy that: Nothing Is Impossible
Blogger Comment
Facebook Comment