Hugo - How to escape the html characters for the shortquote like <!--more-->

Hello,

I am a newbie to the Hugo and have been enjoying my learning journey with the help of wonderful people around here in the Discourse Forum.

I recently added a Read More... tag on the Summary Page of the listing. I also found that the “” keyword/clause has a role to play. I wanted to make a note in my blog (for my self reference).

However, I am not able to escape the HTML characters to get them properly displayed. I have googled to find out a few links and followed the suggestions as well - but no luck.

  1. Escaping Hugo shortcodes suggesting to use “/*” before the beginning and ending of the corresponding HTML character to be escaped. Example, “<” , “>” in my case.
  2. htmlEscape | Hugo suggesting me to use the htmlEscape built in function with the surrounding double curly braces “{{” and “}}”.

My post.md file goes as follows and the result is displayed as a screenshot subsequently.

# Read More Conditional in Summary

The `Read More...` link gets conditionally displayed in the `<YOUR_SITE>\layouts\default\list.html` file with a 
*conditional* clause. Also the {{ </* !--more-- /*> }} in each specific blog post contributes additionally to render the `Read More` text. 

This blog post intentionally gets ended here without any *{{ htmlEscape "<" }}!--more--{{ htmlEscape "<" }}* to demonstrate the same. 

How do I really achieve the escape of texts? Any help would be highly appreciated.

Cheers,
RM…

&lt;!&#45;&#45;more&#45;&#45;>
2 Likes

@jmooring , perfect. Thanks :slight_smile: That was an easy alternative. It works fine now.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.