Jamling / hexo-generator-i18n

Multi-languages generator for hexo.
MIT License
35 stars 10 forks source link

more than 2 langs malfunction #2

Closed aliaksejenka closed 8 years ago

aliaksejenka commented 8 years ago

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 i18narchive(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);