|
|
@@ -763,10 +763,12 @@ const organizeData = (data, lang) => {
|
|
|
doc.thumb = `${host}/thumbs/coloring-page/page/480/${doc._id}.jpeg`;
|
|
|
doc.zip = `${host}/zips/v2/number_mini/${version}/${doc._id}.zip`;
|
|
|
|
|
|
+ let uriTitle = doc.name;
|
|
|
if (doc.title) {
|
|
|
try {
|
|
|
let titleJson = JSON.parse(doc.title);
|
|
|
doc.title = titleJson && titleJson[lang] ? titleJson[lang] : doc.name;
|
|
|
+ if (titleJson.en) uriTitle = titleJson.en; // URL 里还是尽量用英文title
|
|
|
} catch (e) {
|
|
|
console.error(e.message);
|
|
|
}
|
|
|
@@ -774,7 +776,7 @@ const organizeData = (data, lang) => {
|
|
|
doc.title = doc.name;
|
|
|
}
|
|
|
|
|
|
- let utf8name = encodeURIComponent(doc.title.replace(/[\s_]+/g, '-')).toLowerCase();
|
|
|
+ let utf8name = encodeURIComponent(uriTitle.replace(/[\s_]+/g, '-')).toLowerCase();
|
|
|
doc.uri = `/${lang}/coloring-page/${utf8name}-${doc._id}`;
|
|
|
|
|
|
delete doc.hasSpecial;
|
|
|
@@ -796,10 +798,13 @@ const organizeDetail = (doc, lang) => {
|
|
|
|
|
|
// doc.title = translate.titleTest[lang];
|
|
|
// doc.desc = translate.descTest[lang];
|
|
|
+
|
|
|
+ let uriTitle = doc.name;
|
|
|
if (doc.title) {
|
|
|
try {
|
|
|
let titleJson = JSON.parse(doc.title);
|
|
|
doc.title = titleJson && titleJson[lang] ? titleJson[lang] : doc.name;
|
|
|
+ if (titleJson.en) uriTitle = titleJson.en; // URL 里还是尽量用英文title
|
|
|
} catch (e) {
|
|
|
console.error(e.message);
|
|
|
}
|
|
|
@@ -816,7 +821,7 @@ const organizeDetail = (doc, lang) => {
|
|
|
}
|
|
|
doc.publishTime = format(new Date(doc.publishTime), 'yyyy/MM/dd');
|
|
|
|
|
|
- let utf8name = encodeURIComponent(doc.title.replace(/[\s_]+/g, '-')).toLowerCase();
|
|
|
+ let utf8name = encodeURIComponent(uriTitle.replace(/[\s_]+/g, '-')).toLowerCase();
|
|
|
doc.uri = `/${lang}/coloring-page/${utf8name}-${doc._id}`;
|
|
|
|
|
|
doc.downlink = `${host}/thumbs/coloring-page/page/1200/${doc._id}.jpeg`;
|