以下內容属于 ‘sitemap’ 便签:

Discuz X3.4免插件采用定时任务自动生成sitemap.xml

为了更好的利于SEO,加快百度、360、谷歌、bing、搜狗等收录,我们需要网站生成sitemap.xml,有些搜索引擎只支持.xml,不支持.txt,所以我们必须在511遇见论坛下自动生成sitemap.xml,由于我们采用了伪静态,所以生成的链接必须和伪静态规则一致,在discuz后台插件搜索了几个,姑且不谈收费免费,发现很不稳定,且静态规则无法兼容,这里我们采用discuz的定时任务,自动生成itemap.xml 手动建立一个cron_sitemap.php文件复制以下内容 注意自己discuz的编码,我这里utf-8,注意手动修改。 点此下载cron_sitemap.php 12345678910111213141516171819202122232425262728293031323334353637383940414243<?php /*  *    $ cron_sitemap.php  2019-11-23  网站地图 计划任务版 bbs.511yj.com  */   if(!defined('IN_DISCUZ')) {     exit('Access Denied'); }   $filename='sitemap.xml'; //以下五项根据具体情况修改即可 $cfg_updateperi='60';//协议文件更新周期的上限,单位为分钟 $web_root=$_G['siteurl'];//根网址 $CHARSET='utf-8';// or gbk //选择编码方式 /***********************************************************************************************/ //网站地图sitemap.xml $sitemap="<?xml version="1.0" encoding="UTF-8"?>\n"; $sitemap.="<urlset\n"; $sitemap.="xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"\n"; $sitemap.="xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\n"; $sitemap.="xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9\n"; $sitemap.="http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">\n";     $querys = DB::query("SELECT a.tid FROM ".DB::table('forum_thread')." a inner join ".DB::table('forum_forum')." b […] (more...)

让插件baidu-sitemap-generator支持WordPress自定义文章类型

这里以自定义文章类型“shuoshuo”为例,涉及插件/baidu-sitemap-generator/baidu_sitemap.php的两处修改,174行和314行,废话不多说,直接贴代码。(举例为”baidu-sitemap-generator v1.6.5) 找到插件的baidu_sitemap.php文件,打开。 找到174行代码 1AND (post_type='post' or post_type='page') 改为: 1AND (post_type='post' or post_type='page' or post_type='shuoshuo') 找到314行代码 1AND post_type='post' 改为: 1AND (post_type='post' or post_type='shuoshuo') 来源:https://www.mrwu.red/biji/801.html (more...)