我們在製作版型的時候,通常會使用手風琴元件製作FAQ效果,而這個效果通常是給人類讀的。
為了讓Google爬蟲檢索時,能有效的識別FAQ的相關資訊,就可以使用FAQ Schema。
在這個AI,你只要把你的html結構貼給AI,馬上就可以生成對應的Schema。
為什麼使用Html元件無法產生結構化資料呢?
如果你使用HTML元件是無法產生這個結構得,為什麼呢?
但 Elementor 為了避免使用者插入惡意腳本,會「移除看起來無用的 <script>
」,尤其是:
<script type="application/ld+json">
✅(你遇到的)<script type="text/ld+json">
<script type="text/template">
- 其他「非 text/javascript」的
<script>
型別
➡️ 所以當你貼到「HTML 元件」後,Elementor 預覽畫面沒顯示、儲存後再打開也會被刪掉。
正確的方式!! 使用 Elementor Pro 的 Customer Code
1. 到 WordPress 後台 ➜ 點選「Elementor → Custom Code」
2. 點「Add New」命名:例如 FAQ Structured Data
3. 在輸入框中貼入
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "FAQPage",
"mainEntity": [
{
"@type": "Question",
"name": "Can the v-grooved slats panel be used to resurface furniture?",
"acceptedAnswer": {
"@type": "Answer",
"text": "Yes, the v-grooved slats panel is popular for furniture restoration and resurfacing. Many creative DIY projects can be found on platforms like TikTok and Pinterest."
}
},
...
]
}
</script>
5. 在Conditions功能設定要綁定的頁面
如果我是使用WPML的多國語言網站呢?
就只能使用程式碼片段(Code )的外掛做相對應的語言處理
add_action('wp_footer', function () {
if ( function_exists('icl_object_id') && defined('ICL_LANGUAGE_CODE') && ICL_LANGUAGE_CODE === 'en' ) {
?>
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "FAQPage",
"mainEntity": [ /* 你的英文 FAQ JSON 內容 */ ]
}
</script>
<?php
}
});
語言名稱 | 語言代碼(ICL_LANGUAGE_CODE) |
---|---|
繁體中文 | zh-hant |
簡體中文 | zh-hans |
英文 | en |
日文 | ja |
韓文 | ko |
法文 | fr |
德文 | de |
西班牙文 | es |
義大利文 | it |
越南文 | vi |
泰文 | th |
印尼文 | id |
荷蘭文 | nl |
葡萄牙文(巴西) | pt-br |
葡萄牙文(歐洲) | pt |
俄文 | ru |
阿拉伯文 | ar |
希臘文 | el |
土耳其文 | tr |
波蘭文 | pl |
匈牙利文 | hu |