1. 在templets文件下建立文件sitemap.xml(注意是在templets文件夹下而非模板文件)
在sitemap.xml文件中写入:
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://www.panyunlong.com/(这边换上你自己的域名)</loc>
<lastmod>{dede:arclist row=1 titlelen=24 orderby=pubdate}
[field:pubdate function=strftime('%Y-%m-%d',@me)/]
{/dede:arclist}</lastmod>
<changefreq>daily</changefreq>
<priority>1.0</priority>
</url>
{dede:channel row='10' type='top'}
<url>
<loc>[field:typelink /]</loc>
<changefreq>daily</changefreq>
<priority>0.8</priority>
</url>
{/dede:channel}
{dede:arclist row=2000 orderby=pubdate}
<url>
<loc>[field:arcurl/]</loc>
<lastmod>[field:pubdate function=strftime('%Y-%m-%d',@me)/]</lastmod>
<changefreq>monthly</changefreq>
</url>
{/dede:arclist}
</urlset>
2. 在根目录/plus/task文件夹下建立文件,名:panyunlong_sitemap.php
在panyunlong_sitemap.php这个文件中写入:
<?php
require_once(dirname(__FILE__).'/../../include/common.inc.php');
include(DEDEINC."/arc.listview.class.php");
$lv = new ListView();
//解析模板到字符串
$lv->PartView = new PartView($lv->TypeID,false);
$lv->PartView->SetTypeLink($lv->TypeLink);
$lv->PartView->SetTemplet(DEDETEMPLATE.'/sitemap.xml');
$html = $lv->PartView->GetResult();
file_put_contents('../../sitemap.xml',$html);
?>
3. 织梦后台添加新计划任务
登陆织梦后台-系统-计划任务管理-添加新任务
具体可按照下面内容填写即可

4. 最后一步,在网站footer.htm页面加入
<script language="javascript" src="https://www.panyunlong.com(换成你自己域名)/plus/task/generate_sitemap.php"></script>
这样整套教程就已经全部结束了,以后只要有人点击页面,网站地图就会自动更新,搭配自己采集插件网站就可以实现自动更新自动提交网站地图了,如果搭配上自动推送效果会更明显!
郑重声明:本文版权归原作者所有,转载文章仅为传播更多信息之目的,如作者信息标记有误,请第一时间联系我们修改或删除,多谢。