CMS MADE SIMPLE FORGE

SiteMapMadeSimple

 

[#6659] [Enhancement Request] Limit sitemap entries to a certain level

avatar
Created By: Sanjay Cherubala (spcherub)
Date Submitted: Wed Jul 13 15:01:17 -0400 2011

Assigned To: Robert Campbell (calguy1000)
Version: 1.2.2
CMSMS Version: None
Severity: Minor
Resolution: None
State: Open
Summary:
[Enhancement Request] Limit sitemap entries to a certain level
Detailed Description:
Right now the module generates a sitemap that includes all active pages on the
site including sub-pages.

It would be great to have the option of limiting the number of levels in the
generated XML file - so for instance I could specify that only top-level pages
are included in the sitemap. This could be done using a simple option in the
module admin interface.


History

Comments
avatar
Date: 2012-01-06 22:27
Posted By: Philippe Thomas (filto)

you can do it simply like this .

{if ctype_digit($page->hierarchy)}

Check for numeric character  of param hierarchy page ( in  sitemap template)

like this

--------------------
<?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">

{foreach from=$output item='page'}
{if ctype_digit($page->hierarchy)}
<url>
  <loc>{$page->url}</loc>
  <lastmod>{$page->date|date_format:"%Y-%m-%d"}</lastmod>
  <priority>{$page->priority}</priority>
  <changefreq>{$page->frequency}</changefreq>
</url>
{/if}
{/foreach}
</urlset>
------------------

Only show top-level pages  in the sitemap

;)