LinkTitle
LinkTitle
方法返回在前端配置中定義的 linkTitle
字段,若未設定則回退為 Title
方法返回的值。
content/articles/healthy-desserts.md
---
linkTitle: Dessert recipes
title: Seventeen delightful recipes for healthy desserts
---
+++
linkTitle = 'Dessert recipes'
title = 'Seventeen delightful recipes for healthy desserts'
+++
{
"linkTitle": "Dessert recipes",
"title": "Seventeen delightful recipes for healthy desserts"
}
{{ .LinkTitle }} → Dessert recipes
如上所示,在前端配置中定義 linkTitle
字段有助於當頁面標題過長時使用。此字段特別適用於生成模板中的 <a>
標籤:
<a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a>