Question about the multi-dimensional content model

I’m starting a new documentation site, and I’m wondering if the multi-dimensional content model introduced in v0.153 would be helpful in my situation.

I would only want certain sections to be versioned. So “docs” would be the latest version, and would be filled in by “v2.0” and “v1.0”. The home page and release notes would not be versioned. I’m finding it a little hard to understand how it works, so would someone be able to confirm if this is possible?

content/ (mysite.com/)
├── docs/ (mysite.com/docs)
│   └── _index.md
├── v2.0/ (mysite.com/v2.0)
│   ├── features/
│   │   └── index.md
│   └── _index.md
├── v1.0/ (mysite.com/v1.0)
│   ├── features/
│   │   └── index.md
│   └── _index.md
├── release-notes/ (mysite.com/release-notes)
│   ├── v3.0.1.md
│   ├── v3.0.0.md
│   ├── v2.1.0.md
│   └── _index.md
└── _index.md

I haven’t given any thought to the details of your request, but have you looked at this example?

https://discourse.gohugo.io/t/is-there-an-example-of-how-to-use-the-new-multidimensional-content-model/56516/12

Yep, I have, and it answered most of my questions. Thank you.

The main question remaining for me is whether it’s possible to have a setup where certain sections of a site are not versioned, including the home page.

Yes, it is possible.

I just modified the example to move the home page to the content root, then added a default mount.

git clone --single-branch -b hugo-forum-topic-56516 https://github.com/jmooring/hugo-testing hugo-forum-topic-56516
cd hugo-forum-topic-56516
hugo server

I just modified the example again, adding a Posts section (un-versioned).

Ah ok, I think this answered my question, but just to confirm…

Even with un-versioned sections, they will still have the version appended to the URL, correct?

For the new posts section, the URL ends up being http://mysite/v0.1.0/posts/ or http://mysite/v0.2.0/posts/, depending on what version was selected. There’s no way to have just http://mysite/posts/?

The blog post example is a great use case for what I’m trying to sort out. I’m trying to avoid having URLs like: http://mysite/v0.3.0/blog/1/01/post-1/, since v0.3.0 has nothing to do with the blog post. I’ve tried overriding this with permalinks, but that didn’t seem to work.

Let’s put this on hold until I can dig a little deeper. I looked more carefully at the published site structure, and determined that my earlier guidance in this topic, and the related changes to the example project, are just… wrong.

I’ve revised the example project:

git clone --single-branch -b hugo-forum-topic-56516 https://github.com/jmooring/hugo-testing hugo-forum-topic-56516
cd hugo-forum-topic-56516
hugo server

This is the content structure with the home page and posts section unversioned:

content structure
content/
├── unversioned/
│   ├── posts/
│   │   ├── _index.md
│   │   ├── post-1.md
│   │   └── post-2.md
│   └── _index.md
├── v0.1.0/
│   └── docs/
│       ├── functions/
│       │   ├── _index.md
│       │   ├── average.md
│       │   └── mean.md
│       └── _index.md
├── v0.2.0/
│   └── docs/
│       └── functions/
│           ├── mean.md
│           └── variance.md
├── v0.3.0/
│   └── docs/
│       └── functions/
│           ├── average.md
│           ├── standard-deviation.md
│           └── variance.md
└── v0.4.0/
    └── docs/
        └── functions/
            └── median.md

And this is the mount for the unversioned content:

project config
module.mounts]]
  source = 'content/unversioned'
  target = 'content'
  [module.mounts.sites]
    [module.mounts.sites.matrix]
      versions = '**'

Given that each unique combination of language, version, and role is its own site, you cannot control the publishing path with a permalinks setup in your project config. You could set the url in front matter for each page of the unversioned content, but that means those pages will be written multiple times (e.g., run hugo --printPathWarnings).

Thank you so much for the updated prototype and confirming how the urls work with unversioned content. I also confirmed that url does not work on the home page, so it doesn’t appear that I can have a page at mysite.com without it redirecting to mysite.com/version/.

This was very helpful, and seems like I was trying to use this feature for something it was probably not intended for. The next time I have a docs site with only versioned content, I’ll definitely be using this.