templates.Exists
少于1分钟
将以下英文翻译为中文:
templates.Exists
https://gohugo.io/functions/templates.exists/
Checks whether a template file exists under the given path relative to the layouts directory.
语法
templates.Exists PATH
A template file is any file living below the layouts directories of either the project or any of its theme components including partials and shortcodes.
The function is particularly handy with dynamic path. The following example ensures the build will not break on a .Type missing its dedicated header partial.
| |
另请参阅
- Create Your Own Shortcodes
- Hugo’s Lookup Order
- RSS Templates
- Section Page Templates
- Single Page Templates
最后修改 June 1, 2023: 新增一个配置参数:sidebar_menu_truncate = 500 用于解决菜单不全的问题 (27810f1)