fix(docs): add translation link to avoid GitHub
This commit is contained in:
committed by
Mrugesh Mohapatra
parent
778a5fc2e8
commit
7287fe9f2b
@ -33,4 +33,12 @@
|
||||
|
||||
</div>
|
||||
|
||||
<br />
|
||||
<br />
|
||||
<br />
|
||||
|
||||
<div style='text-align: center'>
|
||||
|
||||
Interested in updating the translations? Visit: <https://translate.freecodecamp.org>
|
||||
|
||||
</div>
|
@ -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 --
|
||||
|
||||
});
|
||||
}
|
||||
]
|
||||
|
Reference in New Issue
Block a user