IsSection

IsSection 方法用於判斷 Page 物件是否為區段頁面。如果頁面類型是 section,則返回 true

用法範例

以下是頁面結構的範例:

content/
├── books/
│   ├── book-1/
│   │   └── index.md  <-- kind = page
│   ├── book-2.md     <-- kind = page
│   └── _index.md     <-- kind = section
└── _index.md         <-- kind = home

以下是如何在模板中使用 IsSection 方法:

{{ .IsSection }}

頁面類型