Thêm dữ liệu breadcrumb trong widget Blog1 version 2

Mặc định thì trong widget Blog1 version 2 không có đường dẫn breadcrumb do đó nếu bạn đang sử dụng mẫu template mặc định v3 hoặc đã nâng cấp lên bạn có thể thêm dữ liệu breadcrumb. Bài này mình sẽ hướng dẫn cách thêm vào widget Blog1 version 2.

Thêm dữ liệu breadcrumb trong widget Blog1 version 2

+ Các bạn vào chỉnh sửa mẫu chọn Chuyển đến tiện ích > Blog1 thêm thẻ tag <b:includable id=’breadcrumb’ var=’posts’> ngay sau thẻ tag <b:includable id=’addComments’>

Copy

<b:includable id='breadcrumb' var='posts'>

<b:if cond='!data:view.isHomepage'>

  <b:if cond='data:view.isPage'>

    <div class='breadcrumbs'>

      <a expr:href='data:blog.homepageUrl' expr:title='data:messages.home'>

        <data:messages.home/>

      </a>

      &#8250;

      <a expr:href='data:blog.canonicalUrl' expr:title='data:blog.pageName'>

        <data:blog.pageName/>

      </a>

    </div>

    <b:else/>

    <b:if cond='data:view.isPost'>

      <b:loop values='data:posts' var='post'>

        <b:if cond='data:post.labels'>

          <div class='breadcrumbs' xmlns:v='http://rdf.data-vocabulary.org/#'>

            <span typeof='v:Breadcrumb'>

              <a expr:href='data:blog.homepageUrl' expr:title='data:messages.home' property='v:title' rel='v:url'>

                <data:messages.home/>

              </a>

              &#8250;               

              <b:if cond='data:post.labels'>

                <b:loop values='data:post.labels' var='label'>

                  <span rel='v:child' typeof='v:Breadcrumb'>

                    <a expr:href='data:label.url + &quot;?&amp;max-results=&quot;+15' expr:title='data:label.name' property='v:title' rel='v:url'>

                      <data:label.name/>

                    </a>

                  </span>

                  <b:if cond='data:label.isLast != &quot;true&quot;'> &#8250; </b:if>

                </b:loop>

              </b:if>

            </span>

          </div>

          <b:else/>

          <div class='breadcrumbs'>

            <a expr:href='data:blog.homepageUrl' expr:title='data:messages.home'>

              <data:messages.home/>

            </a>

            &#8250;

            <a expr:href='data:blog.canonicalUrl' expr:title='data:navMessage'><data:navMessage/></a>

          </div>

        </b:if>

      </b:loop>

      <b:else/>

      <b:if cond='data:view.isArchive'>

        <div class='breadcrumbs'>

          <a expr:href='data:blog.homepageUrl' expr:title='data:messages.home'>

            <data:messages.home/>

          </a>

          &#8250;

          <a expr:href='data:blog.canonicalUrl' expr:title='data:blog.pageName'>

            <data:blog.pageName/>

          </a>

        </div>

        <b:else/>

        <b:if cond='data:view.isMultipleItems and !data:view.isLabelSearch'>

          <div class='breadcrumbs'>

            <b:if cond='data:blog.pageName == &quot;&quot;'>

              <a expr:href='data:blog.homepageUrl' expr:title='data:messages.home'>

                <data:messages.home/>

              </a>

              &#8250;

              <a expr:href='data:olderPageUrl' expr:title='data:messages.morePosts'>

                <data:messages.morePosts/>

              </a>

              <b:else/>

              <a expr:href='data:blog.homepageUrl' expr:title='data:messages.home'>

                <data:messages.home/>

              </a>

              &#8250;

              <a expr:href='data:blog.canonicalUrl' expr:title='data:blog.pageName'>

                <data:blog.pageName/>

              </a>

            </b:if>

          </div>

        </b:if>

        <b:if cond='data:view.isLabelSearch'>

          <div class='breadcrumbs' xmlns:v='http://rdf.data-vocabulary.org/#'>

            <span typeof='v:Breadcrumb'>

              <a expr:href='data:blog.homepageUrl' expr:title='data:messages.home' property='v:title' rel='v:url'>

                <data:messages.home/>

              </a>

              &#8250;

              <span rel='v:child' typeof='v:Breadcrumb'>

                <h1>

                  <a expr:href='data:blog.canonicalUrl' expr:title='data:blog.pageName' property='v:title' rel='v:url'>

                    <data:blog.pageName/>

                  </a>

                </h1>

              </span>

            </span>

          </div>

        </b:if>

      </b:if>

    </b:if>

  </b:if>

</b:if>

</b:includable>

Hình minh họa:

Thêm dữ liệu breadcrumb trong widget Blog1 version 2

+ Khi thêm xong mở rộng thẻ tag <b:includable id=’main’> nó nằm ngay phía trên các bạn thêm thẻ tag <b:include data=’posts’ name=’breadcrumb’/> ngay trên thẻ tag <b:include name=’super.main’/>

Hình minh họa

Thêm dữ liệu breadcrumb trong widget Blog1 version 2

+ Các bạn viết css cho class .breadcrumb phù hợp.

View Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

Published by
5 years ago