Check if there are links before iterating through them
Merge branch 'master' of https://github.com/GeoNode/geonode
use elif to avoid duplicated jpeg link