Jamling/hexo-generator-i18n

more than 2 langs malfunction

aliaksejenka opened this issue · 0 comments

I have 3 languages configured in _config.yml's 'language', and when generating archive page for the 3rd language some url strings become prepended with previos lang as such: 'lang2/lang3/tag/tagname'.

Possibly here the copy.data member after extend()'ing remains the reference, and something like the _.cloneDeep() should be used instead:

function i18n_archive(locals) {
...
for (var i = 1; i< languages.length; i++){
var l = languages[i];
var copy = {};
_.extend(copy, item);
copy.path = l + '/' + item.path;
copy.data.base = l + '/' + item.data.base; // .base contains the string from previous iteration
...
result.push(copy);