Skip to content

Commit 313ea40

Browse files
committed
Use alternate way to set collection section pages' layout to single
Under the `collections` section, this website has been using the directory structure in a different way from Hugo's assumption on sections. Hugo treats a sub-section's _index.md differently from other pages: _index.md uses a section template rather than a single template. However, this website designates a sub-section's _index.md as an equal page to other pages with regards to the template applied. The old way this website used to render an _index.md under the `collections` section using a single template is to call `.Render "single"` in the section template applied to the `collections` section (`layouts/_default/collections.html`). However, this way has stopped working since Hugo v0.146.2. Therefore, it is now necessary to switch to a new way to achieve this effect: under the `collections` section, for each page with the `section` kind, set `layout: single` in the page's front matter. Nevertheless, this alternate way is probably clearer and less quirky even if the old way was not broken.
1 parent 03bceb3 commit 313ea40

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

config/_default/hugo.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ cascade:
2525
- _target:
2626
path: '/collections{,/**}'
2727
kind: 'section'
28+
# Render a collection sub-section's landing page as a regular page
29+
layout: 'single'
2830
outputs:
2931
# Drop 'RSS'
3032
- 'HTML'

layouts/_default/collections.html

Lines changed: 0 additions & 2 deletions
This file was deleted.

0 commit comments

Comments
 (0)