How to extend or duplicate content?

I’m looking for a way to extend a existing markdown file. For example:

free-article.md
---
foo: bar
bar: stool
----

Free content

And then I want to extend the information from the free article in a paid-article.md

paid-article.md
---
foo: bar (extend from free-article.md)
bar: stool (extend from free-article.md)
paid: only param
---

Free content (extend from free-article.md)

Paid content

I thought maybe to abuse the multi language feature, but don’t know if that is the way to go.

There is no way to do what you ask with Hugo natively, as far as I know -but I would love to be proved wrong-.

Currently the only way I would think that you can encrypt a different version or part of a HTML page and hide it behind a paywall, would be on the frontend with JS.

Utilize a JS encryption library as part of a deploy script to selectively manipulate Hugo’s generated HTML.

Recently I opened the following GitHub issue asking for native support to frontend JS encryption:

I’m using a JS library to encrypt parts of a page. You can see it working here: https://brunoamaral.eu/story/crypto/chapter-2/

And you can get it here: https://github.com/bitwiseshiftleft/sjcl

In my case it’s a caesar cypher, which is weak.

Currently hard/impossible…?

I jotted down this issue https://github.com/gohugoio/hugo/issues/5139 some time ago.

Which kind of would model roles on top of languages, but you would then be able to do:

{{ if role.IsMember }}
{{ end }}

In templates etc. etc. It’s a while since I wrote the above, but I sill it’s a great idea, so it must be.

1 Like