其他设置 底部信息、联系方式与全局脚本等 <a href="/sitemap.xml" target="_blank">网站地图</a>
备案号代码: <a href="https://beian.miit.gov.cn/" target="_blank" rel="nofollow">备案号</a>
日收 周收教程:
关闭:内页时间因子,在文章专题页自定义底部代码/JS代码 ,添加实时刷新时间因子,时间因子为实时更新。(蜘蛛只要抓页面,就会日收 周收)
代码:
<footer>
<div>发布时间:<span id="publishTime" style="font-weight:bold;color:#333"></span></div>
</footer>
<script>
// 确保DOM完全加载后执行
window.addEventListener('DOMContentLoaded', () => {
const now = new Date();
// 生成符合百度要求的中文时间格式
const timeStr = `${now.getFullYear()}年${String(now.getMonth()+1).padStart(2,'0')}月${String(now.getDate()).padStart(2,'0')}日 ` +
`${String(now.getHours()).padStart(2,'0')}:${String(now.getMinutes()).padStart(2,'0')}:${String(now.getSeconds()).padStart(2,'0')}`;
// 更新页面显示
document.getElementById('publishTime').textContent = timeStr;
// 更新百度SEO结构化数据
const schemaScript = document.querySelector('script[type="application/ld+json"]') ||
document.createElement('script');
schemaScript.type = 'application/ld+json';
schemaScript.textContent = JSON.stringify({
"@context": "https://schema.org",
"@type": "WebPage",
"datePublished": now.toISOString(),
"dateModified": now.toISOString()
}, null, 2);
// 确保结构化数据标记存在
if (!document.querySelector('script[type="application/ld+json"]')) {
document.head.appendChild(schemaScript);
}
});
</script>
<!-- 百度SEO结构化数据标记 -->
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "WebPage",
"datePublished": "",
"dateModified": ""
}
</script>

