各位站长,有没有发现引蜘蛛越来越难了,这里分享一点实用小技巧,
以wellcms为例,其他cms对照修改。
header.inc 中添加:
<!--结构化数据标记!-->
<script type=application/ld+json>{
"@context": {
"@context": {
"images": {
"@id": "http://schema.org/image",
"@type": "@id",
"@container": "@list"
},
"title": "http://schema.org/headline",
"description": "http://schema.org/description",
"pubDate": "http://schema.org/DateTime"
}
},
"@id": "<?php echo http_url_path(),$thread['url']; ?>",
"title": "<?php echo $header['title'];?>-<?php echo $conf['sitename'] ;?>",
"description": "<?php echo $header['description'];?>",
"pubDate": "<?php echo date('Y-m-dTH:i:s', $thread['create_date']);?>",
"upDate": "<?php echo date('Y-m-dTH:i:s', $thread['create_date']);?>"
}
</script>
<!--百度落地页时间因子改造代码-->
<script type="application/ld+json">
{
"@context":"https://ziyuan.baidu.com/contexts/cambrian.jsonld",
"@id":"<?php echo http_url_path(),$thread['url']; ?>",
"title":"<?php echo $header['title'];?>-<?php echo $conf['sitename'] ;?>",
"description":"<?php echo $header['description'];?>",
"pubDate":"<?php echo date('Y-m-dTH:i:s', $thread['create_date']);?>",
"upDate":"<?php echo date('Y-m-dTH:i:s', $thread['create_date']);?>",
"data":{
"webPage":{
"headline":"<?php echo $header['title'];?>-<?php echo $conf['sitename'] ;?>",
"tag":["<?php echo $_tagname; ?>"],
"pcUrl":"<?php echo http_url_path(),$thread['url']; ?>",
"wapUrl":"<?php echo http_url_path(),$thread['url']; ?>",
"fromSrc":"<?php echo $conf['sitename'] ;?>",
"datePublished":"<?php echo date('Y-m-dTH:i:s', $thread['create_date']);?>"
}
}
}
</script>
<!--百度结束!-->
Footer.inc 中添加:
<!--百度js推送-->
<script>
(function() {
var bp = document.createElement('script');
var curProtocol = window.location.protocol.split(':')[0];
if (curProtocol === 'https') {
bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';
} else {
bp.src = 'http://push.zhanzhang.baidu.com/push.js';
}
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(bp, s);
})();
</script>
<!--头条js推送-->
<script>
(function(){
var el = document.createElement("script");
el.src = "https://lf1-cdn-tos.bytegoofy.com/goofy/ttzz/push.js?e448d1d295ebd87df3932d7cfd4ecf1af98a960a2e77072ff75818bf8f965c5845f9b46c8c41e6235de98982cdddb9785e566c8c06b0b36aec55fccc04fff972a6c09517809143b97aad1198018b8352";
el.id = "ttzz";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(el, s);
})(window)
</script>
<!-- miao -->
<script>
(function() {
var abdr = document.createElement('script');
abdr.src = 'https://dlswbr.baidu.com/heicha/mw/abclite-2036-s.js';
abdr.setAttribute('async', 'async');
abdr.setAttribute('defer', 'defer');
var abdrj = document.getElementsByTagName('script')[0];
abdrj.parentNode.insertBefore(abdr, abdrj);
// 动态获取当前域名和当前页面URL
var currentDomain = '${currentDomain}';
var currentPageURL = '<?php echo http_url_path(),$thread['url']; ?>';
// 使用模板字符串构建推送URL
var pushURL = `${currentDomain}view/template/你的主题/htm/push-endpoint.php`;
var xhr = new XMLHttpRequest();
xhr.open('POST', pushURL, true);
xhr.setRequestHeader('Content-Type', 'application/json;charset=UTF-8');
xhr.send(JSON.stringify({ message: '<?php echo $header['title'];?>', pageURL: currentPageURL }));
})();
</script>
<!--baidugiftijiao-->
<iframe src="https://sp1.baidu.com/5bU_dTmfKgQFm2e88IuM_a/w.gif?q=site%3Awww%2Eseomoban%2Ecn&rsv_xpath=div-div-div-p2-a-img(<?php echo $thread['icon_fmt'];?>)&title=<?php echo $header['title'];?>&url=<?php echo http_url_path(),$thread['url']; ?>&rsv_height=225&rsv_width=368*rsv_tpl=right_tab&fm=alxr&p1=1&mu=<?php echo http_url_path(),$thread['url']; ?>&rsv_srcid=12561&p5=1&ala_anti=ck0@1714979164190,ck1@0,ck3@950,ck6@0,ck7@1714979163197&rsv_sid=40305_40488_40080&cid=0&qid=9243baec0009e93c&t=1714979163197&rsv_pstg=20&rsv_cftime=1&rsv_iorr=1&rsv_tn=baidu&rsv_ssl=1&path=http%3A%2F%2Fwww.baidu.com%2Fs%3Fie%3Dutf-8%26f%3D8%26rsv_bp%3D1%26tn%3Dbaidu%26wd%3Dsite%253Awww.seomoban.cn%26oq%3Dsite%25253Awww.seomoban.cn%26rsv_pq%3Df2814fbf00549d9b%26rsv_t%3D1a9dekCaX%252Fr1NumHd0DWibENqYjXCz%252FH05OATRITcPR8X1YXA7DCDqssRFA%26rqlang%3Dcn%26rsv_enter%3D0%26rsv_dl%3D0%26rsv_btype%3Dt&rsv_did=d34d7bf400b6b9aeb201a8fa853940ca" frameBorder="0" width="900" scrolling="no" height="1"></iframe>
push-endpoint.php 代码:
<?php
header('Content-Type: application/json');
// 检查请求方法
if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
http_response_code(405);
echo json_encode(['error' => 'Only POST requests are allowed']);
exit;
}
// 获取传入的JSON数据
$data = json_decode(file_get_contents('php://input'), true);
// 调试输出
file_put_contents('debug.log', print_r($data, true), FILE_APPEND);
// 检查JSON解析是否成功
if (json_last_error() !== JSON_ERROR_NONE) {
http_response_code(400);
echo json_encode(['error' => 'Invalid JSON']);
exit;
}
// 处理传入的数据
$message = isset($data['message']) ? htmlspecialchars($data['message']) : '';
$pageURL = isset($data['pageURL']) ? filter_var($data['pageURL'], FILTER_SANITIZE_URL) : '';
// 返回响应
http_response_code(200);
echo json_encode(['status' => 'success', 'message' => $message, 'pageURL' => $pageURL]);
// 调试输出
file_put_contents('debug.log', "Message: $message, PageURL: $pageURL\n", FILE_APPEND);
?>
![图片[1]-结构化数据标记 有机率会来蜘蛛-SEO模板](https://www.seomoban.cn/wp-content/uploads/2026/01/endpoint-300x127.jpg)
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END









