"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 = {
github: {
repo: "lbryio/lbry.tech",
docsBranch: "master/content",
editLinkText: "Edit this page on GitHub"
branch: "new",
linkText: "Edit this page on GitHub",
repo: "lbryio/lbry.tech"
},
ga: "UA-60403362-1"
};

View file

@ -16,13 +16,24 @@ const config = local("/config");
// P R O G R A M
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`;
else githubUrl = `${githubUrl}/${config.github.docsBranch}${pagePath}.md`; // TODO: Update this to match new site structure
switch(pagePath) {
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`
<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>
`;
};