丝袜av在线观看|日本美女三级片在线播放|性欧美一区二区三区|小骚热免费国产视频|黑人va在线观看|女同国产91视频|五月丁香色播Av|国产凸凹视频一区二区|伊人电影久久99|国产成人无码一区二区观看

相關(guān)文檔標(biāo)簽

說明:獲取當(dāng)前文檔的相關(guān)文檔。相關(guān)文檔的邏輯是:根據(jù)當(dāng)前文檔的文檔id,獲取同分類的臨近文檔。因此該標(biāo)簽只能在文檔詳情頁(yè)使用。

使用方法:{% archiveList 變量名稱 with type="related" limit="10" %} 如將變量定義為 archives {% archiveList archives with type="related" limit="10" %}...{% endarchiveList %}

type 的值為 related 的情況下,不支持 order 參數(shù)。

type 的值為 related 的情況下,支持 like 參數(shù)。 like=“keywords|relation”,默認(rèn)不需要 like 參數(shù),它自動(dòng)獲取最靠近當(dāng)前文檔的其他文檔。如果指定了 like=“keywords”,則會(huì)根據(jù)文檔第一個(gè)關(guān)鍵詞來獲取相關(guān)的文檔。如果指定了 like=“relation”,則只會(huì)展示后臺(tái)文檔編輯界面設(shè)置的相關(guān)文檔。

archives 是一個(gè)數(shù)組對(duì)象,因此需要使用 for 循環(huán)來輸出

item 為 for循環(huán)體內(nèi)的變量,可用的字段有:

  • 文檔ID Id
  • 文檔標(biāo)題 Title
  • 文檔鏈接 Link
  • 文檔關(guān)鍵詞 Keywords
  • 文檔描述 Description
  • 文檔分類ID CategoryId
  • 文檔瀏覽量 Views
  • 文檔封面圖片 Images
  • 文檔封面首圖 Logo
  • 文檔封面縮略圖 Thumb
  • 文檔評(píng)論數(shù)量 CommentCount
  • 文檔添加時(shí)間 CreatedTime 時(shí)間戳,需要使用格式化時(shí)間戳為日期格式 {{stampToDate(item.CreatedTime, "2006-01-02")}}
  • 文檔更新時(shí)間 UpdatedTime 時(shí)間戳,需要使用格式化時(shí)間戳為日期格式 {{stampToDate(item.UpdatedTime, "2006-01-02 15:04:05")}}
  • 文檔標(biāo)簽
  • 文檔模型設(shè)置的其他字段參數(shù)

代碼示例

獲取相關(guān)文檔標(biāo)簽,只能在文檔詳情頁(yè)使用。

{# related 相關(guān)文檔列表展示 #}
<div>
{% archiveList archives with type="related" limit="10" %}
    {% for item in archives %}
    <li>
        <a href="{{item.Link}}">
            <h5>{{item.Title}}</h5>
            <div>{{item.Description}}</div>
            <div>
                <span>{% categoryDetail with name="Title" id=item.CategoryId %}</span>
                <span>{{stampToDate(item.CreatedTime, "2006-01-02")}}</span>
                <span>{{item.Views}} 閱讀</span>
            </div>
        </a>
        {% if item.Thumb %}
        <a href="{{item.Link}}">
            <img alt="{{item.Title}}" src="{{item.Thumb}}">
        </a>
        {% endif %}
    </li>
    {% empty %}
    <li>
        該列表沒有任何內(nèi)容
    </li>
    {% endfor %}
{% endarchiveList %}
</div>
問題反饋可加技術(shù)微信:tsrz001
目錄