% var featureimg = url_for('/medias/bg.jpg'); if (page.img) { featureimg = url_for(page.img); } else { var hashCode = function (str) { if (!str && str.length === 0) { return 0; } var hash = 0; for (var i = 0, len = str.length; i < len; i++) { hash = ((hash << 5) - hash) + str.charCodeAt(i); hash |= 0; } return hash; }; var len = theme.featureImages.length; var num = Math.abs(hashCode(page.title) % len); featureimg = theme.jsDelivr.url ? theme.jsDelivr.url + url_for(theme.featureImages[num]) : url_for(theme.featureImages[num]); } %>