<% function layoutDiv() { var el = ''; var repo; var branch = 'main'; if (page.layout === 'wiki' && page.wiki) { let proj = theme.wiki.projects[page.wiki]; if (proj && proj.repo) { repo = proj.repo; if (proj.branch !== undefined) { branch = proj.branch; } } } else { // 其它的如果有设置 repo 也可以 repo = page.repo; } if (repo === undefined) { return el; } // 布局 el += '
'; el += '
'; var items = []; // Readme items.push({ icon: '', text: 'Readme', href: 'https://github.com/' + repo + '#readme' }); // Releases items.push({ icon: '', text: 'Releases', href: 'https://github.com/' + repo + '/releases' }); // Download items.push({ icon: '', text: 'Download', href: 'https://github.com/' + repo + '/archive/refs/heads/' + branch + '.zip' }); // Issues items.push({ icon: '', text: 'Issues', href: 'https://github.com/' + repo + '/issues' }); items.forEach((item, i) => { el += ''; }); el += '
'; el += '
'; return el; } %> <%- layoutDiv() %>