Disqus – How to Include & in Comments

commentsdisqus

I followed an example on a tutorial to create Spring MyBatis example. I got an error following the instructions in the document. However, I have solved my issue on a tutorial I followed to create an application and I want to post how I solved it. It was using & instead of & text which solved the issue for me.

I want the ampersand to be included in the comment section as like, &amp;. But after posting the comments it displays, the & instead of &amp;. I've tried to include it inside the <code></code> block and also tried to wrap it around with the <pre><code></code></pre> block but it doesn't work.

So how can I post the code block comment to display the &amp; string?

Best Answer

You need to (manually) HTML entity encode the HTML entity in order to display a literal HTML entity! In other words:

&amp;amp;

In fact, you need to manually HTML entity encode most HTML if you want to display the literal HTML in the comment, since Disqus allows you to use several HTML tags in order to format your comments.