作者:yyyy | 来源:互联网 | 2023-02-05 11:47
我在我的网站gintlemen.com上使用Algolia,我不想要帖子,通过Yoast SEO插件设置为noindex,由Algolia索引.
我发现这篇文章https://community.algolia.com/wordpress/indexing-flow.html,但我不知道在哪里放这个片段.
你能帮帮我吗?
1> rayrutjes..:
要排除Yoast标记为"noindex"的帖子,您需要将以下代码段添加到functions.php
您的活动主题中.
ID, '_yoast_wpseo_meta-robots-noindex', true) == 1 ? false : true;
}
// Hook into Algolia to manipulate the post that should be indexed.
add_filter( 'algolia_should_index_searchable_post', 'filter_post', 10, 2 );
add_filter( 'algolia_should_index_post', 'filter_post', 10, 2 );