'How to add a GIF into Pug template?
I was trying to display a gif from Giphy to the webpage through pug. Here is my code:
gif(src='https://giphy.com/embed/u458Fo50SS1K3kqVyK') It's not working. Anyone knows what the pug syntax should be?
Solution 1:[1]
- Instead of
gifmust be used theimg(src="URL_TO_IMAGE") - The
https://giphy.com/embed/u458Fo50SS1K3kqVyKURL is not an image. It is the link to HTML site with image, but not URL to gif file. Your image URL must have valid image mime type.
Following example works:
img(src='https://www.w3.org/2008/site/images/logo-w3c-mobile-lg')
Solution 2:[2]
You can use image tag and src to url or save gif to images folder and provide path
<img src="url"/>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | biodiscus |
| Solution 2 | Hardi Patel |
