I am currently utilizing PUG to display the results of an API call. Among the properties returned is a link to an image, which I would like to showcase in the final column. Ideally, I want to ensure that the image size is responsive and doesn't overwhelm the entire page.
Within the array of objects being passed, you can locate the image link here: item.result.image.contentUrl
Sample HTML code:
head
title= Results
link(rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous")
body
table(class="table table-striped")
thead(class="thead-dark")
tr
th(scope="col") Result for #{searchTerm}
th(scope="col") Description
th(scope="col") Image
tbody
each item in searchData
tr
td(scope="row")= item.result.name
td(scope="row")= item.result.description
if !item.result.image
td(scope="row") Image not found
else
td(scope="row") img(src= item.result.image.contentUrl)
The current implementation of the last row seems incorrect. Despite my efforts, I have been unable to find any helpful resources on this issue. Would appreciate any suggestions or guidance?