Hugo

Embed page content to other page

Hello.

I want to make site for small shop.
And i have idea: create custom post type price, add some posts with prices for categories. And then embed prices in regular posts with relevant content.

How can i do this?

This is how I do it:

In content/sitewide/authorfooter.md

---
title: "Some title"
headless: true
---

content of the page

then include this at the location where I want the post to appear:

{{ with .Site.GetPage "page" "sitewide/authorfooter.md" }}
          <div id="authorfooter">
            <h3>{{ .Title }}</h3>
            {{ .Content }}
          </div>
        {{ end }}       

Another way would surely be a shortcode solution.