Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Product link image preview not displayed in WhatsApp with HTML minification enabled #6156

Closed
PanagLtd opened this issue Mar 2, 2022 · 1 comment

Comments

@PanagLtd
Copy link

PanagLtd commented Mar 2, 2022

nopCommerce version: 4.4

Steps to reproduce the problem:
NOTE: You can jump to step 6 and use specified link from nopCommerce demo website.

  1. Go to Admin>Configuration>Settings>General Settings>
  2. Check "HTML minification" setting
  3. Check "Twitter META tags" setting
  4. Check "Open Graph META tags" setting
  5. Save and restart website
  6. Copy link of any product details public page that has an image. You can use the link from nopCommerce demo website: https://demo.nopcommerce.com/build-your-own-computer
  7. Go to WhatsApp in your phone and paste this link in the text box of any chat conversation.

You will see that product image is not displayed in WhatsApp link preview like expected.

Solution:
HTML minification has removed double-quote characters from meta tag attribute values so it looks like this:
<meta property=og:image content=https://demo.nopcommerce.com/images/thumbs/0000020_build-your-own-computer_550.jpeg>
If we add double quotes to all "og:image" meta tag attributes or to "twitter:image" meta tag attributes then image preview will work:
<meta property="og:image" content="https://demo.nopcommerce.com/images/thumbs/0000020_build-your-own-computer_550.jpeg">

In addition to another issue I posted about problem caused by HTML minification #6155. Maybe there should be a set of settings for how "intense" minification should be applied on HTML. for example some settings:

  • Keep attribute double quotes
  • Keep text new lines

Even with both checked page will still minify significantly due to removal of closing tags.

Simplified valid/invalid HTML for WhatsApp for testing:
whatsapp-valid-image.html.txt
whatsapp-invalid-image.html.txt

@exileDev
Copy link
Contributor

exileDev commented Apr 4, 2022

Closed #6156

@exileDev exileDev closed this as completed Apr 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants