Posts with sub-pages

Please excuse me if this has been answered before, but I just haven’t been able to find an answer. It seems like a very simple question, but well, let’s see.

I’m trying to have a site where my posts can have sub-pages that can be linked to from the posts, but aren’t considered posts, themselves.

Based on my readings so far, and given my understanding of leaf bundles and branch bundles, it is not a straightforward matter to arrange things so that all these are valid URLs showing normal web content (ie none are listings):

  1. mysite/posts/my-first-post/
  2. mysite/posts/my-second-post/
  3. mysite/posts/my-second-post/some-details/

I want #1 and #2 to be classified as “posts”, and I want #3 to be a “post subpage” (preferably without explicit typing in matter, but I’ll accept that if it’s the best way). How is this done?

The first one is straightforward, of course. It is generated from content/posts/my-first-post. But then, how do I (preferably automatically) classify some-details as something other than a post? I want it to be processed, but I don’t want it showing up in the list of posts. After that’s working, I still need to know how to generate the output for the main my-second-post page and have it shown in listings of posts.

I’m really hoping that I’ve misunderstood something, or that this needn’t be solved by lots of trickery and overriding of implicit typing. But even if the solution does require jumping through hoops, your advice will be appreciated!!

By definition, list pages are _index.md. And it is not mandatory to have an _index.md file in a (local) directory.

The question of whether the sources are accurate:

mysite/posts/my-first-post.md
mysite/posts/my-second-post.md
mysite/posts/my-second-post/some-details.md

is not the same as:

mysite/posts/my-first-post/_index.md
mysite/posts/my-second-post.md
mysite/posts/my-second-post/some-details/index.md

is not the same as:

mysite/posts/my-first-post/_index.md
mysite/posts/my-second-post.md
mysite/posts/my-second-post/some-details/_index.md

mmh, I read that a few times and each time I get a different understanding of your target.

especially this

I want it to be processed, but I don’t want it showing up in the list of posts.` you don’t want my-first-post to show up in /posts listings?

Let me nevertheless give some hints to consider.

  • keep in mind, that a section (folder containing _index.md) is also a Page. The content of that pages depends on your templates.

    /layouts
    │
    ├───posts
    │       section.html   <-- this renders Posts (*all* folders with an _index.md)
    │       page.html      <-- this renders sub pages (all *not* containing an _index.md)
    

    If your section does not range over pages, you get no listing.
    dunno if you want to nest subpages within subpages or it’s just a two level stuff

  • you could also use front matter layout parameter to target a template.

    layout = 'post
    layout = 'subpage'
    

    and use named layouts regardless of page kind

    /layouts
    │
    ├───posts
    │       post.html      <-- this renders Posts
    │       subpage.html   <-- this renders sub pages
    
  • block pages from being listed can be achived using build options
    with this in your /content/posts/_index.md’s front matter. nothing in /postswill be listed in any page collection but renderd, so you can use GetPage or links to refer to pages

    [[cascade]]
     [cascade.build]
       list = 'never'
       render = 'always'
    

    as I said, I’m not sure if you need some listings somewhere. linking all manual seems glumbsy

  • cascade can also be used to propate params to child pages
    with this in your /content/posts/_index.md all toplevel entries (/posts/xxx.md and /posts/xxx/index.md) will get layout = 'post' all deeper get layout = 'subpage'

    [[cascade]]
      [cascade.params]
        layout = 'post'
      [cascade.target]
        path = '/posts/*'
    [[cascade]]
      [cascade.params]
        layout = 'subpage'
      [cascade.target]
        path = '/posts/*/**'
    
  • keep in mind, that if you do: posts/one.md and posts/one/subone.md both pages logically belong to the Posts section


I did not understand all details about your intent: pages(nested), classifiy(?), listing and accessing pages, but I hope that helps:

  • to get a feeling whats possible (and there is more)
  • detailing your target structure and usage.
Example content tree - (post-3 varaint I would not recommend)
ONTENT\POSTS
│   post-3.md
│   _index.md
│
├───post-1
│   │   sub-1-1.md
│   │   sub-1-2.md
│   │   _index.md
│   │
│   ├───sub-1-3
│   │       index.md
│   │
│   └───sub-1-4
│           sub-1-4-1.md
│           _index.md
│
├───post-2
│   │   _index.md
│   │
│   ├───sub-2-1
│   │       index.md
│   │
│   └───sub-2-2
│           index.md
│
└───post-3
    │   sub-3-2.md
    │
    └───sub-3-1
            index.md