"Edit link" partial is fixed

This commit is contained in:
ポール ウェッブ 2018-07-13 13:22:46 -05:00
parent 29c817e2d2
commit 272ff4ed74
2 changed files with 18 additions and 7 deletions

View file

@ -4,9 +4,9 @@
module.exports = exports = { module.exports = exports = {
github: { github: {
repo: "lbryio/lbry.tech", branch: "new",
docsBranch: "master/content", linkText: "Edit this page on GitHub",
editLinkText: "Edit this page on GitHub" repo: "lbryio/lbry.tech"
}, },
ga: "UA-60403362-1" ga: "UA-60403362-1"
}; };

View file

@ -16,13 +16,24 @@ const config = local("/config");
// P R O G R A M // P R O G R A M
const editLink = pagePath => { const editLink = pagePath => {
let githubUrl = `https://github.com/${config.github.repo}/edit`; let githubUrl = `https://github.com/${config.github.repo}/edit/${config.github.branch}`;
if (pagePath === "/") githubUrl = `${githubUrl}/master/README.md`; switch(pagePath) {
else githubUrl = `${githubUrl}/${config.github.docsBranch}${pagePath}.md`; // TODO: Update this to match new site structure case "":
githubUrl = `${githubUrl}/views/pages/home.js`;
break;
case "/resources":
githubUrl = `${githubUrl}/views/pages/resources.js`;
break;
default:
githubUrl = `${githubUrl}/documents${pagePath}.md`;
break;
}
return html` return html`
<a href="${githubUrl}" target="_blank" rel="noopener noreferrer" title="${config.github.editLinkText}">${config.github.editLinkText}</a> <a href="${githubUrl}" target="_blank" rel="noopener noreferrer" title="${config.github.linkText}">${config.github.linkText}</a>
`; `;
}; };