hexo.extend.helper.register('get_s3_link', function(link, project){ if(project.files == undefined) return link.url; for (let i = 0; i < project.files.length; i++) { const file = project.files[i]; if(file.title == link.file){ if(file.s3 != undefined){ return file.s3.url; } } } return link.url; }); hexo.extend.helper.register('has_s3_link', function(link, project){ if(project.files == undefined) return false; for (let i = 0; i < project.files.length; i++) { const file = project.files[i]; if(file.title == link.file){ if(file.s3 != undefined){ return true; } } } return false; });