內容簡介
Article JSON-LD 是一個可擴充且簡單的解決方案,可以透過在網站文章上加入 Schema.org 微資料作為 JSON-LD script,來提升您的網站 SEO。
它會自動插入 JSON-LD script 到您網站的 <head> 標籤中,並使用 WordPress 提供的標準資訊(例如標題、描述、精選圖片、發布日期、作者、類別等)。
您可以使用外掛的 hooks,支援您的自訂文章類型或輕鬆修改資料。
自訂文章類型支援
預設情況下,外掛支援 post 文章類型。使用以下示例的代碼片段添加其他自訂文章類型的支援:
add_action('init', 'add_article_json_ld_post_type_support', 15);
/**
* @return void
*/
function add_article_json_ld_post_type_support()
{
add_post_type_support('custom-post-type', 'article-json-ld');
}
您可以使用 Code Snippets 外掛將代碼片段添加到您的網站中。
在 Arageek 文章中提供了主動演示。
外掛的 Hooks
ArticleJsonLd\post_json_ld_data 用於文章 JSON-LD 資料的篩選器。
ArticleJsonLd\post_author_json_ld_data 用於文章作者 JSON-LD 資料的篩選器。
ArticleJsonLd\post_publisher_json_ld_data 用於文章發佈者 JSON-LD 資料的篩選器。
貢獻
開發人員可以在 Github 存儲庫 上貢獻源代碼。
外掛標籤
開發者團隊
原文外掛簡介
Article JSON-LD is an extendable and straightforward solution to enhance your site SEO by adding Schema.org microdata as a JSON-LD script on your site posts.
It will automatically insert the JSON-LD script in your site
You can support your custom post types or modify the data easily by using the plugin’s hooks.
Custom-Post-Types Support
By default, the plugin supports the post post-type. Add support for other custom-post-types using a code snippet as the example below:
add_action('init', 'add_article_json_ld_post_type_support', 15);
/**
* @return void
*/
function add_article_json_ld_post_type_support()
{
add_post_type_support('custom-post-type', 'article-json-ld');
}
You can use Code Snippets plugin to add the code snippets to your site.
An active demo is available on Arageek articles.
Plugin’s Hooks
ArticleJsonLd\post_json_ld_data A filter for a post JSON-LD data.
ArticleJsonLd\post_author_json_ld_data A filter for a post author JSON-LD data.
ArticleJsonLd\post_publisher_json_ld_data A filter for a post publisher JSON-LD data.
Contributing
Developers can contribute to the source code on the Github Repository.
