Forum for discussing general topics related to Couch.
2 posts Page 1 of 1
I am trying to make a dynamic sitemap so when new blog articles are added, they get added to the sitemap automatically so came across what KK made viewtopic.php?f=8&t=7173 and amended it so it includes the folders and exclude the globals.php which is working but I would like to exclude specific folders such as projects, gallery and clients so tried to add the following in but its still showing the projects folder links

Code: Select all
<cms:if k_template_name!='projects.php'>
           
<cms:folders masterpage=k_template_name>
        <url>
            <loc><cms:show k_folder_link /></loc>
        </url>
    </cms:folders>
               
              </cms:if>


Think it may be to do with the following but want the blog folder to show

Code: Select all
<cms:if k_template_is_clonable >
               <cms:pages masterpage=k_template_name>
               <url>
                  <loc><cms:show k_page_link /></loc>
               <lastmod><cms:date "<cms:if k_page_modification_date='0000-00-00 00:00:00'><cms:show k_page_date /><cms:else /><cms:show k_page_modification_date /></cms:if>" format='Y-m-d\TH:i:s+00:00' gmt='1' /></lastmod>
               </url>
      </cms:pages>
               </cms:if>


Below is the whole code I currently have

Code: Select all
<?php require_once( 'cms/cms.php' ); ?>
<cms:content_type 'text/xml' /><cms:concat '<' '?xml version="1.0" encoding="' k_site_charset '"?' '>' />
<urlset
      xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
            http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
           
   <cms:templates order='asc' >
       <cms:if (k_template_name eq 'sitemap.php') || (k_template_name eq 'globals.php') >
           <cms:else />
           <cms:if k_template_name eq 'index.php'>
           <url>
            <loc><cms:show k_template_link /></loc>
               <lastmod><cms:date "<cms:if k_page_modification_date='0000-00-00 00:00:00'><cms:show k_page_date /><cms:else /><cms:show k_page_modification_date /></cms:if>" format='Y-m-d\TH:i:s+00:00' gmt='1' /></lastmod>
               <changefreq>daily</changefreq>
               <priority>1.00</priority>
           </url>
           <cms:else />
               <cms:if k_template_name eq 'grays/health-safety-services.php'>
                   <url>
            <loc><cms:show k_template_link /></loc>
               <lastmod><cms:date "<cms:if k_page_modification_date='0000-00-00 00:00:00'><cms:show k_page_date /><cms:else /><cms:show k_page_modification_date /></cms:if>" format='Y-m-d\TH:i:s+00:00' gmt='1' /></lastmod>
               <changefreq>daily</changefreq>
               <priority>1.00</priority>
           </url>
              <cms:else />     
            <url>
            <loc><cms:show k_template_link /></loc>
               <lastmod><cms:date "<cms:if k_page_modification_date='0000-00-00 00:00:00'><cms:show k_page_date /><cms:else /><cms:show k_page_modification_date /></cms:if>" format='Y-m-d\TH:i:s+00:00' gmt='1' /></lastmod>
               <changefreq>weekly</changefreq>
               <priority>0.64</priority>
           </url>
                   
           <cms:if k_template_name!='projects.php'>
           
<cms:folders masterpage=k_template_name>
        <url>
            <loc><cms:show k_folder_link /></loc>
        </url>
    </cms:folders>
               
              </cms:if>
               
               <cms:if k_template_is_clonable >
               <cms:pages masterpage=k_template_name>
               <url>
                  <loc><cms:show k_page_link /></loc>
               <lastmod><cms:date "<cms:if k_page_modification_date='0000-00-00 00:00:00'><cms:show k_page_date /><cms:else /><cms:show k_page_modification_date /></cms:if>" format='Y-m-d\TH:i:s+00:00' gmt='1' /></lastmod>
               </url>
      </cms:pages>
               </cms:if>

</cms:if>
           </cms:if>
        </cms:if>
           
   </cms:templates>

</urlset>
<?php COUCH::invoke(); ?>


Just can't seem to work out how to exclude the specific folders links like projects, clients and gallery

a example in the sitemap is below that I want to exclude and not show

Code: Select all
<url>
<loc>
https://www.domain.co.uk/projects/adm-milling-tilbury-docks.html
</loc>
<lastmod>2021-04-04T12:28:52+00:00</lastmod>
</url>
Think I have just sorted it with the following code

Code: Select all
<?php require_once( 'cms/cms.php' ); ?>
<cms:content_type 'text/xml' /><cms:concat '<' '?xml version="1.0" encoding="' k_site_charset '"?' '>' />
<urlset
      xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
            http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
           
   <cms:templates order='asc' >
       <cms:if (k_template_name eq 'sitemap.php') || (k_template_name eq 'globals.php') >
           <cms:else />
           <cms:if k_template_name eq 'index.php'>
           <url>
            <loc><cms:show k_template_link /></loc>
               <lastmod><cms:date "<cms:if k_page_modification_date='0000-00-00 00:00:00'><cms:show k_page_date /><cms:else /><cms:show k_page_modification_date /></cms:if>" format='Y-m-d\TH:i:s+00:00' gmt='1' /></lastmod>
               <changefreq>daily</changefreq>
               <priority>1.00</priority>
           </url>
           <cms:else />
               <cms:if k_template_name eq 'grays/health-safety-services.php'>
                   <url>
            <loc><cms:show k_template_link /></loc>
               <lastmod><cms:date "<cms:if k_page_modification_date='0000-00-00 00:00:00'><cms:show k_page_date /><cms:else /><cms:show k_page_modification_date /></cms:if>" format='Y-m-d\TH:i:s+00:00' gmt='1' /></lastmod>
               <changefreq>daily</changefreq>
               <priority>1.00</priority>
           </url>
              <cms:else />
            <url>
            <loc><cms:show k_template_link /></loc>
               <lastmod><cms:date "<cms:if k_page_modification_date='0000-00-00 00:00:00'><cms:show k_page_date /><cms:else /><cms:show k_page_modification_date /></cms:if>" format='Y-m-d\TH:i:s+00:00' gmt='1' /></lastmod>
               <changefreq>weekly</changefreq>
               <priority>0.64</priority>
           </url>
                   
                   <cms:if (k_template_name eq 'gallery.php') || (k_template_name eq 'projects.php') || (k_template_name eq 'clients.php')  >
                       <url>
                       <loc></loc>
                       </url>
           <cms:else />
<cms:folders masterpage=k_template_name>
        <url>
            <loc><cms:show k_folder_link /></loc>
        </url>
    </cms:folders>
               
               <cms:if k_template_is_clonable >
               <cms:pages masterpage=k_template_name>
               <url>
                  <loc><cms:show k_page_link /></loc>
               <lastmod><cms:date "<cms:if k_page_modification_date='0000-00-00 00:00:00'><cms:show k_page_date /><cms:else /><cms:show k_page_modification_date /></cms:if>" format='Y-m-d\TH:i:s+00:00' gmt='1' /></lastmod>
               </url>
      </cms:pages>
               </cms:if>

</cms:if>
           </cms:if>
        </cms:if>
           </cms:if>
           
   </cms:templates>

</urlset>
<?php COUCH::invoke(); ?>


It shows the main page in the sitemap for example https://www.domain.co.uk/projects/ but don't show the html files cloned from it if that makes sense
2 posts Page 1 of 1
cron