puresyntax71 / hugo-theme-chunky-poster

A simple, bootstrap 4 based hugo blog theme.
https://hugo-theme-chunky-poster.netlify.com
MIT License
109 stars 86 forks source link

HTML tags appearing in Home page UI and in the generated Public HTML (escaped form) #159

Open bhrigu123 opened 3 years ago

bhrigu123 commented 3 years ago

Hi, firstly, great work with the theme.

On building the site in my local, the generated index.html in the Public directory has escaped HTML tags in the posts cards which appear in the Home Page. Thus, while viewing the home page, I see the actual HTML tags (like \<p>) in the text of the posts cards.

Attaching screenshots below:

  1. One of the card in the index.html in Public/ dir:

    Screenshot 2020-12-07 at 11 23 54 AM
  2. How this card looks in the UI:

    Screenshot 2020-12-07 at 11 24 43 AM

More details:

Also, the first post card in the Home Page (which appears at the top and covers a complete row), does not have this issue. Just the post cards appearing as tiles in the home page has them.

If there are any links in the article, they start appearing also in the UI (as they are escaped in the generated HTML) as \<a link...>

Let me know how to resolve the HTML tags appearing issue.

Thanks.

bhrigu123 commented 3 years ago

Could this be a result of #135 PR ?

bhrigu123 commented 3 years ago

Yes it looks like it's a result of that only. On using plainify again, I'm not seeing the escaped HTML codes.

However, now it's not able to escape the special characters in the card now. For eg. ' is appearing as &requo;

In my markdown I have no HTML, just plain text. However, the htmlUnescape is adding escaped \<p> to my HTML which is appearing in UI

bhrigu123 commented 3 years ago

So for me the following is working: If we have to use htmlUnescape, we should use planify after it to remove any HTML tags. ie, use {{ $page.Summary | htmlUnescape | plainify }}. This works fine for me.

7onetella commented 3 years ago

@bhrigu123 thanks for posting your fix. I was having the same issue.

mv1005 commented 2 years ago

Hi, I am playing around with Hugo for the first time to create a blog and found this very nice theme. Thanks for the work.

Unfortunately I am also facing the issue of appearing HTML tags in the post cards. The workaround posted above by @bhrigu123 works, but I was wondering if there would be any chance to integrate the fix in a future release to solve this issue.

I am suggesting this because that issue even breaks the example site shipped with the template. In my opinion, that shouldn't be the case.

Thanks.