Hiding HTML code using the "<!---" tag

Jump to solution
james_botten
Community Member

I'm hoping to use the "<!---" and "--->" tags to hide text in a webpage template so that it can be reused for multiple purposes.  When editing a page in Canvas using the HTML code view, the code after the "<!---" tag is grayed out as expected and when viewing the saved page the relevant text is hidden.

However it seems this hidden text is actually deleted, as when the page is re-opened for editing, all the relevant HTML code between the "<!---"/"--->" tags is simply not there. 

I know I can store multiple pages as templates, but I'd prefer to have the flexibility of working with fewer templates that have hidden code snippets to reactivate as needed.

Is this a glitch or is there some specific reason for the "<!---" tag working this way?

Labels (1)
0 Likes
1 Solution
Chris_Hofer
Community Coach
Community Coach

Good evening, @james_botten ...

I don't think it's a glitch.  There are only certain HTML elements that are allowed in the Canvas RCE (Rich Content Editor).  You can read more about this by checking out the following PDF file in this Guide: Canvas HTML Editor Allowlist PDF - Instructure Community (canvaslms.com).

Hope this helps a bit.

View solution in original post