
I had to create sitemap.xml for all subpages and news so i did it this way:
1. Create page template called sitemap:
Code: Select all
{set_content_type type="text/xml"}<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.google.com/schemas/sitemap/0.84" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.google.com/schemas/sitemap/0.84 http://www.google.com/schemas/sitemap/0.84/sitemap.xsd">
{menu template='sitemap' show_all='1' collapse='0'}
{cms_module module="news" summarytemplate="sitemap"}
</urlset>
Code: Select all
{if $count > 0}
{assign var='now' value=$smarty.now|strtotime}
{foreach from=$nodelist item=node}
{if $node->url != '#' && $node->url != ''}
<url>
<loc>{$node->url}</loc>
<lastmod>{$node->modified|date_format:'%Y-%m-%dT%T-08:00'}</lastmod>
<changefreq>{assign var='mod' value=$node->modified|strtotime}{math assign='age' equation="(n-m)/86400" n=$smarty.now m=$mod}{if $age < 2}hourly{elseif $age< 14}daily{elseif $age < 30}weekly{else}monthly{/if}</changefreq>
<priority>{math equation="1/y - x/100" x=$node->index y=$node->depth format="%1\$.2F"}</priority>
</url>
{/if}
{/foreach}
{/if}

x/100 -> 100 its max page count. If you have 500 pages or more, enter x/1000 or something like that
3. Create News template called sitemap:
Code: Select all
{foreach from=$items item=entry}
<url>
<loc>{$entry->moreurl}</loc>
{if $entry->modified_date}
<lastmod>{$entry->modified_date|date_format:'%Y-%m-%dT%T-08:00'}</lastmod>
{/if}
<changefreq>{assign var='mod' value=$entry->modified_date|strtotime}{math assign='age' equation="(n-m)/86400" n=$smarty.now m=$mod}{if $age < 2}hourly{elseif $age< 14}daily{elseif $age < 30}weekly{else}monthly{/if}</changefreq>
<priority>0.33</priority>
</url>
{/foreach}

5. Edit/Create .htaccess file and insert there:
Code: Select all
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f [NC]
RewriteCond %{REQUEST_FILENAME} !-d [NC]
RewriteRule ^sitemap.xml$ index.php?page=sitemap [L]
6. Add User Tag set_content_type
Code: Select all
if ($params['type'])
{
global $gCms;
$gCms->variables['content-type'] = $params['type'];
}

I Hope that, it will help
