Explanation of Page Bundles

Question

Could someone please explain to me what exactly is a Page Bundle? I tried to

  • Reading the Docs
  • Googleing It
  • Watch YouTube Videos

But, alas, I still don’t understand it.

If someone could explain it as if they were explaining it to a child, that will be greatly appreciated.

content/
└── books
    ├── book-1.md         <-- page
    ├── book-2            <-- page bundle, specifically a leaf bundle
    │   ├── cover.jpg
    │   └── index.md
    └── book-3            <-- page bundle, specifically a branch bundle
        ├── chapter-1.md
        ├── chapter-2.md
        ├── cover.jpg
        └── _index.md

https://gohugo.io/content-management/page-bundles

  • Leaf Bundle – A directory in content/ (at any nested hierarchy) containing index.md.
  • Branch Bundle – A directory in content/ (at any nested hierarchy) containing _index.md (note the _ prefix)

A page bundle is either a leaf or a branch bundle.

A branch bundle can nest more leaf/branch bundles, while a leaf bundle cannot.


If you do not need the bundles related Hugo features (like resource fetching, etc.), just create plain Markdown files in the content/ directory that are not named index.md or _index.md.

What is the difference between _index.md and index.md?

Umm… just that _index.md marks a directory as branch bundle and another marks a leaf bundle.


See the above link to understand more on the differences between these 2 bundles.


I had written this post when this feature was released few years back: Hugo: Leaf and Branch Bundles ❚ A Scripter's Notes. See if that helps. But I think that the Hugo docs are pretty concise enough.

I really want to use this, but I don’t know where to put my videos. Can you please take a look and explain to me what I need to do? (By the way, I’m not the creator of this repo)

cc/ @martignoni

As stated in the readme put your videos in the page bundle. Reading @kaushalmodi’s post will help.

If you need more help, show us in a repo what you’ve already done.

Here’s my repo.

Also, here’s where I store all of my posts.

I’ve tried putting my *.mp4 videos in multiple locations. I want this blog post to have the video playing.

Here are the locations where I tried to store my videos:

You should copy your video files in the page bundle not in a subfolder. See this example:

with following result:
https://moodlebox.net/en/help/root-certificate-install-macos/

So, I need to store my video files like this:

content
├── notes
├── post
├── videos
├── about.md
└── contact.md

No, like this (adapted from @jmooring, thanks to him):

content/
└── post
    ├── post-1.md         <-- page
    ├── post-2            <-- page bundle, specifically a leaf bundle
    │   ├── cover.jpg
    │   ├── video.mp4
    │   └── index.md
    └── post-3            <-- page bundle, specifically a branch bundle
        ├── chapter-1.md
        ├── chapter-2.md
        ├── cover.jpg
        ├── othervideo.mp4
        ├── yetanothervideo.mp4
        └── _index.md
1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.