Kiểu Book, đơn giản nhất: Mã: <script type="application/ld+json"> { "@context": "http://schema.org/", "@type": "Book", "name": "{$thread.title}", "description": "{xen:helper snippet, $firstPost.message, 155}", "aggregateRating": { "@type": "AggregateRating", "ratingValue": "{$rating}", "bestRating": "5", "ratingCount": "{$thread.thread_rate_count}" } } </script> Kiểu Webpage / dành cho Xenforo Mã: <script type="application/ld+json"> { "@context":"http://schema.org", "@type":"Article", "mainEntityOfPage":{ "@type":"WebPage", "@id":"{xen:link 'threads', {xen:array 'thread_id={$threadId}'}}" }, "headline":"{$thread.title}", "image":{ "@type":"ImageObject", "url":"{$avatar}" }, "datePublished":"{xen:jsescape '{xen:date $thread.post_date, 'Y-m-d'}'}", "dateModified":"{xen:jsescape '{xen:date $thread.last_post_date, 'Y-m-d'}'}", "author":{ "@type":"Person", "name":"{xen:jsescape $thread.username}" }, "publisher":{ "@type":"Organization", "name":"CSO", "logo":{ "@type":"ImageObject", "url":"{xen:helper fullurl, @ogLogoPath, 1}" } }, "aggregateRating":{ "@type":"AggregateRating", "ratingValue":"{$rating}", "bestRating": "5", "reviewCount":"{$thread.thread_rate_count}" } } </script> Kiểu DiscussionForumPosting Mã: <script type="application/ld+json"> { "@context": "http://schema.org", "@type": "DiscussionForumPosting", "@id": "{xen:link 'canonical:threads', $thread}", "headline": "{xen:jsescape $thread.title}", "articleSection": "{xen:jsescape $forum.title}", "articleBody": "{xen:jsescape '{xen:helper snippet, $firstPost.message, 255}'}", "datePublished": "{xen:jsescape '{xen:date $thread.post_date, 'Y-m-d'}'}", "dateModified": "{xen:jsescape '{xen:date $thread.last_post_date, 'Y-m-d'}'}", "image": "{xen:jsescape '{xen:helper avatar, $thread, m, 0, 1}'}", "author": { "@type": "Person", "name": "{xen:jsescape $thread.username}" }, "url": "{xen:link 'canonical:threads', $thread}", "interactionStatistic": { "@type": "InteractionCounter", "interactionType": "https://schema.org/ReplyAction", "userInteractionCount": "{xen:calc "{$totalPosts} - 1"}" } } </script>
Ad ơi, Cho hỏi Mình Đang dùng kiểu DiscussionForumPosting, nhưng vẫn báo lỗi chỗ: Xen: Calc "{$totalPosts} - 1" }"nó báo (Thiếu ', ' hoặc '}' trong kê khai đối tượng) giờ phải làm sao chỉ mình với.