Procházet zdrojové kódy

特殊字符处理

guoziyun před 1 měsícem
rodič
revize
c7bac9b156

+ 4 - 4
views/v2/album.ejs

@@ -182,8 +182,8 @@
 {
   "@context": "https://schema.org",
   "@type": "CollectionPage",
-  "name": "<%= title %>",
-  "description": "<%= description %>",
+  "name": <%- JSON.stringify(title || '') %>,
+  "description": <%- JSON.stringify(description || '') %>,
   "url": "https://art.pcoloring.com<%= uri %>",
   "mainEntity": {
     "@type": "ItemList",
@@ -194,12 +194,12 @@
         "position": <%= index+1 %>,
         "item": {
           "@type": "CreativeWork",
-          "name": "<%= item.title %>",
+          "name": <%- JSON.stringify(item.title || '') %>,
           "url": "https://art.pcoloring.com<%= item.uri %>",
           "image": "https://d2mb6s2cy1zg97.cloudfront.net/thumbs/coloring-page/page/480/<%= item._id %>.webp",
           "author": {
             "@type": "Person",
-            "name": "<%= item.user.username %>"
+            "name": <%- JSON.stringify((item.user && item.user.username) || '') %>
           }
         }
       }<% if(index < data.contents.length - 1){ %>, <%}%>

+ 2 - 2
views/v2/albums.ejs

@@ -107,8 +107,8 @@
         "item": {
           "@type": "CreativeWorkSeries", 
           "url": "https://art.pcoloring.com<%= item.uri %>",
-          "name": "<%= item.title %>",
-          "description": "<%= item.slogon %>",
+          "name": <%- JSON.stringify(item.title || '') %>,
+          "description": <%- JSON.stringify(item.slogon || '') %>,
           "image": "https://d2mb6s2cy1zg97.cloudfront.net/thumbs/coloring-page/album_icon/320/<%= item._id %>.webp"
         }
       }<% if(index < data.length - 1){ %>, <%}%>

+ 2 - 2
views/v2/coloring-page-collection.ejs

@@ -158,8 +158,8 @@
 {
   "@context": "https://schema.org",
   "@type": "CollectionPage",
-  "name": "<%= data.seoTitle %>",
-  "description": "<%= data.seoDescription %>",
+  "name": <%- JSON.stringify(data.seoTitle || '') %>,
+  "description": <%- JSON.stringify(data.seoDescription || '') %>,
   "url": "https://art.pcoloring.com/<%= data.uri %>",
   "mainEntity": {
     "@type": "ItemList",

+ 2 - 2
views/v2/coloring-pages.ejs

@@ -118,8 +118,8 @@
         "item": {
           "@type": "CreativeWorkSeries", 
           "url": "https://art.pcoloring.com<%= item.uri %>",
-          "name": "<%= item.title %>",
-          "description": "<%= item.description %>",
+          "name": <%- JSON.stringify(item.title || '') %>,
+          "description": <%- JSON.stringify(item.description || '') %>,
           "image": "https://d2mb6s2cy1zg97.cloudfront.net/thumbs/coloring-page/work/480/<%= item.id %>.webp"
         }
       }<% if(index < list.length - 1){ %>, <%}%>

+ 4 - 4
views/v2/video-coloring-page.ejs

@@ -228,8 +228,8 @@
 {
   "@context": "https://schema.org",
   "@type": "CollectionPage",
-  "name": "<%= title %>",
-  "description": "<%= description %>",
+  "name": <%- JSON.stringify(title || '') %>,
+  "description": <%- JSON.stringify(description || '') %>,
   "url": "https://art.pcoloring.com<%= uri %>",
   "mainEntity": {
     "@type": "ItemList",
@@ -240,12 +240,12 @@
         "position": <%= index+1 %>,
         "item": {
           "@type": "CreativeWork",
-          "name": "<%= item.title %>",
+          "name": <%- JSON.stringify(item.title || '') %>,
           "url": "https://art.pcoloring.com<%= item.uri %>",
           "image": "https://d2mb6s2cy1zg97.cloudfront.net/thumbs/coloring-page/page/480/<%= item._id %>.webp",
           "author": {
             "@type": "Person",
-            "name": "<%= item.user.username %>"
+            "name": <%- JSON.stringify((item.user && item.user.username) || '') %>
           }
         }
       }<% if(index < data.contents.length - 1){ %>, <%}%>

+ 2 - 2
views/v2/video-coloring-pages.ejs

@@ -429,8 +429,8 @@
   {
     "@context": "https://schema.org",
     "@type": "VideoObject",
-    "name": "<%- item.seoTitle %>",
-    "description": "<%- item.seoDescription %>",
+    "name": <%- JSON.stringify(item.seoTitle || '') %>,
+    "description": <%- JSON.stringify(item.seoDescription || '') %>,
     "thumbnailUrl": "<%= item.poster %>",
     "uploadDate": "<%= new Date(item.timeCreate).toISOString() %>",
     "contentUrl": "<%= item.url %>",