How to show templates as code?

This must be so obvious I do not see it?

While authoring md files, I can not figure out how to stop the template execution? I move them with 4+tabs they execute, I embed them in the markdown code here they execute again?

It seems nobody but me has this problem … I can see hugo/go templates correctly displayed as code, not executed, everywhere…

Can you give an example for what you are doing that does not work? Better yet, a repo we can look at?

2 Likes

“show me the repo” seems highly irrelevant here?

This is like foundation of GO/HUGO/Markdown :slight_smile:

I shall repeat:

In html generated from markdown how does one show GO/HUGO templates without them being executed?

Precisely they are “executed” when one does hugo serve in the project folder.

    {{ "I can show them here as code no problems" }}
    {{ ref "whatever" }}
    {{ source of this comment is not processed by HUGO :)  }}

How do I do the above in md pages inside my hugo project.

Please advise …

As you said, others are able to display the code correctly without Hugo executing them.

Pasting your sample code on a md file on a test site, displays as code for me, and is not executed by Hugo.

So if it does not work for you, then perhaps there is something wrong with how you are doing it.

Maybe something in your config. Maybe something else. But I can only guess, because I don’t know what you are doing and therefore why it isn’t working.

Here’s other options for you: