fix(docs): add translation link to avoid GitHub

This commit is contained in:
Mrugesh Mohapatra
2020-10-04 03:54:52 +05:30
committed by Mrugesh Mohapatra
parent 778a5fc2e8
commit 7287fe9f2b
2 changed files with 31 additions and 8 deletions

View File

@ -33,4 +33,12 @@
</div>
<br />
<br />
<br />
<div style='text-align: center'>
Interested in updating the translations? Visit: <https://translate.freecodecamp.org>
</div>

View File

@ -106,21 +106,36 @@
plugins: [
function (hook, vm) {
hook.beforeEach(function (html) {
if (vm.route.file === '_translations.md') return html;
hook.beforeEach(function (markdown) {
var url =
// -- ignore the translations list page
if (vm.route.file === '_translations.md') return markdown;
// -- add "Update this translation" link for all i18n language pages
if (vm.route.path.search('i18n') === 1) {
var dynamicText = '[<i class="far fa-edit"></i> Update the translation](' +
'https://translate.freecodecamp.org/contributing-docs' +
') or [visit the English version](' +
'/' + vm.route.path.split('/').pop() +
') of this guide to update instructions.';
}
// -- add "Edit this guide on GitHub" link for all English language pages
if (vm.route.path.search('i18n') === -1) {
var dynamicText = '[<i class="far fa-edit"></i> Edit this guide on GitHub](' +
'https://github.com/freeCodeCamp/freeCodeCamp/blob/master/docs/' +
vm.route.file;
var editLink = '[<i class="far fa-edit"></i> Edit this guide on GitHub](' + url + ')';
vm.route.file +
')';
}
return (
html +
markdown +
'\n----\n' +
editLink
dynamicText
);
// -- do not add logic below this line --
});
}
]