Lost in Page Bundles

I want to build a section of use-cases, with content that is composed of multiple content part, each with their own html layout, and with i18n.

The directory would look like this

      - index.en.md
      - index.de.md
      - context.en.md
      - context.de.md
      - index.md
      - testimonial.en.md
      - testimonial.de.md
   - baseof.html
   - single.html

With layouts/use-case/single.html that looks more or less like this

{{ define "main" }}
  <main aria-role="main">
      <header class="homepage-header">
      <div class="use-case-content">
      <div><!-- Content of "context.**.md" --></div>
      <div><!-- Content of "testimonial.**.md" --></div>
{{ end }}

The scenario1 page should include scenario1/context.XX.md and customer5/testimonial.XX.md, with XX being the language code.

testimonial.**.md files look like

title: User Name
picture: "user.jpeg
company: Some,Inc
This is a **made-up** testimonial text.

and context.**.md files look like

title: Some context
You check those flags:
1. First one
2. Second one
3. Third one

I’m not quite sure about the way to go, could you please point me in the right direction about how to:

  1. insert context/testimonial files
  2. handle cross-references (customer5/testimonial.XX.md being used in scenario1)

Thank you

Here’s a great article from @regis on this matter: https://regisphilibert.com/blog/2018/01/hugo-page-resources-and-how-to-use-them/

Perhaps this helps.

Thank you Leo, but it doesn’t seem to go far enough.

The trickiest part being that I need to:

  • bring content (testimonial) from a different bundle (customer5)
  • wrap it in its own html (<div><!-- Content of "testimonial.**.md" --></div>)
  • insert it in the page

So I probably need to have a front matter param in scenario1/index.xx.md that references customer5, that is read by some piece of (short?)code and that will render the testimonial file with the appropriate template.

You could use a shortcode like you mentioned. Something like

{{ $page := site.GetPage (.Get 0) }}
{{ $page.Content }}
1 Like