Thủ thuật blog, Tiện ích blogspot, hướng dẫn làm blogspot, cách làm blogger

Sunday, June 7, 2015

Rút gọn nội dung bài viết trên trang chủ blogspot

Thường thì nội dung trích dẫn của bài viết trên trang chủ mặc đinh theo template làm bạn khó chịu, cảm thấy hơi nhiều và bạn muốn giảm bớt số lượng chữ viết của bài đăng. Hôm nay mình sẽ hướng dẫn cách rút ngắn hơn đoạn trích dẫn này.

Với cách chỉnh sửa này chúng ta sẽ can thiệp vào đoạn code trong phần Blog1, cụ thể là phần <b:includable id='post' var='post'>.

Các bước chỉnh sửa cụ thể như sau:


- Đăng nhập vào blog cần áp dụng
- Vào Mẫu > Chỉnh sửa HTML
- Tìm đến phần Blog1
- Tìm tiếp đến phần <b:includable id='post' var='post'> (các bạn có thể thu gọn trước các đoạn <b:includable cho nhanh )

- Tìm tiếp đến đoạn code tương tự như sau:

<div class='post-body entry-content' expr:id='&quot;post-body-&quot; + data:post.id' expr:itemprop='(data:blog.metaDescription ? &quot;&quot; : &quot;description &quot;) + &quot;articleBody&quot;'>
    <data:post.body/>
    <div style='clear: both;' />
</div>

- Thay đoạn code trên bằng đoạn code sau: 

<div class='post-body entry-content' expr:id='&quot;post-body-&quot; + data:post.id' itemprop='articleBody'>
    <b:if cond='data:blog.pageType != &quot;item&quot;'>
        <b:if cond='data:blog.pageType == &quot;static_page&quot;'>
            <div class='post-body entry-content' expr:id='&quot;post-body-&quot; + data:post.id'>
                <data:post.body/>
                <span class='read-more'>
<a expr:href='data:post.url'>Xem thêm &#8594;</a>
</span>
                <div style='clear:both;' />
            </div>
            <b:else/>
            <div class='post-body entry-content' expr:id='&quot;post-body-&quot; + data:post.id'>
                <div>
                    <data:post.snippet/>
                </div>
                <span class='read-more'>
<a expr:href='data:post.url'>Xem thêm &#8594;</a>
</span>
                <div style='clear:both' />
            </div>
        </b:if>
        <b:else/>
        <!-- Then use the post body as the schema.org description, for good G+/FB snippeting. -->
        <div class='post-body entry-content' expr:id='&quot;post-body-&quot; + data:post.id'>
            <data:post.body/>
            <div style='clear: both;' />
        </div>
    </b:if>
    <div style='clear: both;' />
</div>
- Lưu mẫu và kiểm tra kết quả.


Bài viết liên quan

1 comment: