Post
在此站點設定中,我們啟用 emoji 短代碼 的渲染,並在每個選單項目之前(pre)和之後(post)添加 emoji 短代碼:
hugo.
enableEmoji: true
menus:
main:
- name: About
pageRef: /about
post: ':point_left:'
pre: ':point_right:'
weight: 10
- name: Contact
pageRef: /contact
post: ':arrow_left:'
pre: ':arrow_right:'
weight: 20
enableEmoji = true
[menus]
[[menus.main]]
name = 'About'
pageRef = '/about'
post = ':point_left:'
pre = ':point_right:'
weight = 10
[[menus.main]]
name = 'Contact'
pageRef = '/contact'
post = ':arrow_left:'
pre = ':arrow_right:'
weight = 20
{
"enableEmoji": true,
"menus": {
"main": [
{
"name": "About",
"pageRef": "/about",
"post": ":point_left:",
"pre": ":point_right:",
"weight": 10
},
{
"name": "Contact",
"pageRef": "/contact",
"post": ":arrow_left:",
"pre": ":arrow_right:",
"weight": 20
}
]
}
}
要渲染此選單:
<ul>
{{ range .Site.Menus.main }}
<li>
{{ .Pre | markdownify }}
<a href="{{ .URL }}">{{ .Name }}</a>
{{ .Post | markdownify }}
</li>
{{ end }}
</ul>