在线建站培训
您的位置: 魔客吧 cms教程 phpcms教程 查看内容

PHPCMS制作网站地图的简单方法

2018-5-22 11:02 | 发布者: moke | 栏目:phpcms教程

PHPCMS默认好像没有站点地图的标签,但是当网站栏目划分的很细时,站点地图还是很有必要的,有利于搜索引擎抓取。今天,创想工作室就分享一个简单实现站点地图的办法!

首先我们在栏目那里新添加栏目或者添加单网页(这里以添加单网页为演示)并设置为不在导航显示,模板手动设置为page_sitemap.html,生成规则这样看情况设置,然后在page_sitemap.html适当位置加上以下标签即可。

复制代码
代码如下:

{pc:content action=http://www.moke8.com/data/attachment/portal/201805/22/110259k5qgvhdtt5rovx35.attachcategoryhttp://www.moke8.com/data/attachment/portal/201805/22/110259k5qgvhdtt5rovx35.attach catid=http://www.moke8.com/data/attachment/portal/201805/22/110259k5qgvhdtt5rovx35.attach0http://www.moke8.com/data/attachment/portal/201805/22/110259k5qgvhdtt5rovx35.attach num=http://www.moke8.com/data/attachment/portal/201805/22/110259k5qgvhdtt5rovx35.attach10http://www.moke8.com/data/attachment/portal/201805/22/110259k5qgvhdtt5rovx35.attachsiteid=http://www.moke8.com/data/attachment/portal/201805/22/110259k5qgvhdtt5rovx35.attach$siteidhttp://www.moke8.com/data/attachment/portal/201805/22/110259k5qgvhdtt5rovx35.attach order=http://www.moke8.com/data/attachment/portal/201805/22/110259k5qgvhdtt5rovx35.attachlistorder ASChttp://www.moke8.com/data/attachment/portal/201805/22/110259k5qgvhdtt5rovx35.attach}

首页
{loop $data $r}

{$r[catname]}


{if $top_parentid}
{pc:content action=http://www.moke8.com/data/attachment/portal/201805/22/110259k5qgvhdtt5rovx35.attachcategoryhttp://www.moke8.com/data/attachment/portal/201805/22/110259k5qgvhdtt5rovx35.attach catid=http://www.moke8.com/data/attachment/portal/201805/22/110259k5qgvhdtt5rovx35.attach$r[catid]http://www.moke8.com/data/attachment/portal/201805/22/110259k5qgvhdtt5rovx35.attach num=http://www.moke8.com/data/attachment/portal/201805/22/110259k5qgvhdtt5rovx35.attach15http://www.moke8.com/data/attachment/portal/201805/22/110259k5qgvhdtt5rovx35.attachsiteid=http://www.moke8.com/data/attachment/portal/201805/22/110259k5qgvhdtt5rovx35.attach$siteidhttp://www.moke8.com/data/attachment/portal/201805/22/110259k5qgvhdtt5rovx35.attach order=http://www.moke8.com/data/attachment/portal/201805/22/110259k5qgvhdtt5rovx35.attachlistorder ASChttp://www.moke8.com/data/attachment/portal/201805/22/110259k5qgvhdtt5rovx35.attach}
{loop $data $v}

{$v[catname]}


{/loop}
{/pc}
{/if}
{/loop}
{/pc}

怎样,是不是很简单咧?演示可以看图:

http://www.moke8.com/data/attachment/portal/201805/22/110259k5qgvhdtt5rovx35.attachhttp://www.moke8.com/data/attachment/portal/201805/22/110259k5qgvhdtt5rovx35.attach


文章延伸

很多童鞋看完这篇文章后会:“哪我要是有三级栏目的话怎么弄呢”?OK,今天就再进行完善,代码如下:


复制代码
代码如下:

{pc:content action=http://www.moke8.com/data/attachment/portal/201805/22/110259k5qgvhdtt5rovx35.attachcategoryhttp://www.moke8.com/data/attachment/portal/201805/22/110259k5qgvhdtt5rovx35.attach catid=http://www.moke8.com/data/attachment/portal/201805/22/110259k5qgvhdtt5rovx35.attach0http://www.moke8.com/data/attachment/portal/201805/22/110259k5qgvhdtt5rovx35.attach num=http://www.moke8.com/data/attachment/portal/201805/22/110259k5qgvhdtt5rovx35.attach250http://www.moke8.com/data/attachment/portal/201805/22/110259k5qgvhdtt5rovx35.attachsiteid=http://www.moke8.com/data/attachment/portal/201805/22/110259k5qgvhdtt5rovx35.attach$siteidhttp://www.moke8.com/data/attachment/portal/201805/22/110259k5qgvhdtt5rovx35.attach order=http://www.moke8.com/data/attachment/portal/201805/22/110259k5qgvhdtt5rovx35.attachlistorder ASChttp://www.moke8.com/data/attachment/portal/201805/22/110259k5qgvhdtt5rovx35.attach}

网站首页
{loop $data $r}

{$r[catname]}


{if $top_parentid}
{pc:content action=http://www.moke8.com/data/attachment/portal/201805/22/110259k5qgvhdtt5rovx35.attachcategoryhttp://www.moke8.com/data/attachment/portal/201805/22/110259k5qgvhdtt5rovx35.attach catid=http://www.moke8.com/data/attachment/portal/201805/22/110259k5qgvhdtt5rovx35.attach$r[catid]http://www.moke8.com/data/attachment/portal/201805/22/110259k5qgvhdtt5rovx35.attach num=http://www.moke8.com/data/attachment/portal/201805/22/110259k5qgvhdtt5rovx35.attach150http://www.moke8.com/data/attachment/portal/201805/22/110259k5qgvhdtt5rovx35.attachsiteid=http://www.moke8.com/data/attachment/portal/201805/22/110259k5qgvhdtt5rovx35.attach$siteidhttp://www.moke8.com/data/attachment/portal/201805/22/110259k5qgvhdtt5rovx35.attach order=http://www.moke8.com/data/attachment/portal/201805/22/110259k5qgvhdtt5rovx35.attachlistorder ASChttp://www.moke8.com/data/attachment/portal/201805/22/110259k5qgvhdtt5rovx35.attach}
{loop $data $t}

{$t[catname]}

{if $t[child]}
{pc:content action=http://www.moke8.com/data/attachment/portal/201805/22/110259k5qgvhdtt5rovx35.attachcategoryhttp://www.moke8.com/data/attachment/portal/201805/22/110259k5qgvhdtt5rovx35.attach catid=http://www.moke8.com/data/attachment/portal/201805/22/110259k5qgvhdtt5rovx35.attach$t[catid]http://www.moke8.com/data/attachment/portal/201805/22/110259k5qgvhdtt5rovx35.attach num=http://www.moke8.com/data/attachment/portal/201805/22/110259k5qgvhdtt5rovx35.attach150http://www.moke8.com/data/attachment/portal/201805/22/110259k5qgvhdtt5rovx35.attachsiteid=http://www.moke8.com/data/attachment/portal/201805/22/110259k5qgvhdtt5rovx35.attach$siteidhttp://www.moke8.com/data/attachment/portal/201805/22/110259k5qgvhdtt5rovx35.attach order=http://www.moke8.com/data/attachment/portal/201805/22/110259k5qgvhdtt5rovx35.attachlistorder ASChttp://www.moke8.com/data/attachment/portal/201805/22/110259k5qgvhdtt5rovx35.attach}
{loop $data $v}
{$v[catname]}

{/loop}
{/pc}
{/if}

{/loop}
{/pc}
{/if}
{/loop}
{/pc}

魔客吧温馨提示:如果你正在寻找优秀的phpcms模板,那你可以到魔客吧的 phpcms模板 频道看看,相信一定有你喜欢的!

最新分享资源

最新评论

验证码 换一个