HUGO
Menu
GitHub 87548 stars Mastodon

Slug

返回给定页面在 front matter 中定义的 URL slug。

Syntax

PAGE.Slug

Returns

string
---
slug: sushi
title: How to make spicy tuna hand rolls
---
+++
slug = 'sushi'
title = 'How to make spicy tuna hand rolls'
+++
{
   "slug": "sushi",
   "title": "How to make spicy tuna hand rolls"
}

此页面将从以下位置提供服务:

https://example.org/recipes/sushi

要在模板中获取 slug 值:

{{ .Slug }} → sushi

Last updated: January 1, 0001
Improve this page