All - just wanted to post this to explain what I did to convert a page in content
to use the new bundle feature. The site I am working on just has a bunch pages under content
:
content/about.md
content/products.md
content/contact.md
etc
I have a page with a figure, so I thought I would use the new bundle feature to display it. When I first converted, I went from:
content/mypage.md
…to:
content/mypage/index.md
But, what happens is, Hugo now assumes “mypage” is a section, and because of that, displays it as a list. To get back to where I was, some changes had to be made.
The frontmatter of the page looks like:
---
date: 2018-01-26T00:00:27+09:00
draft: false
tags:
- red
- blue
title: This is My Page
description: My Page description description description
menu:
main:
name: My Page
url: /mypage/
weight: 50
---
…
First I renamed the index.md
to _index.md
. I understand that in a section, just index.md
will be ignored.
Then I needed to specify a layout for the page. Before I specify the layout in frontmatter, I need a single and its baseof template, for this page. I copied:
layouts/_default/single-baseof.html
layouts/_default/single.html
…to:
layouts/_default/mylayout1-baseof.html
layouts/_default/mylayout1.html
Then I set the frontmatter to use this new layout.
---
date: 2018-01-26T00:00:27+09:00
draft: false
tags:
- red
- blue
title: This is My Page
description: My Page description description description
layout: mylayout1
menu:
main:
name: My Page
url: /mypage/
weight: 50
---
…
And now it works exactly the same as before. To get here I really tried various approaches until it “clicked”. I am not sure if this is the way to do this, and I wanted to ask for comments on it.
Also, I have not yet converted the figure to use a bundled image, so, I am not sure if it will work in a shortcode in this _index.md
file. One step at a time I guess.
Appreciate any comments if someone else has converted and figured out exactly how it works.
Thanks,
Rick
Hugo Static Site Generator v0.35-DEV-8125B4B0 darwin/amd64 BuildDate: 2018-01-22T21:52:05+0900
GOOS="darwin"
GOARCH="amd64"
GOVERSION="go1.9.2"