Forum

Thread tagged as: Problem, Runway

Duplicate Pages in Sitemap

I've added a sitemap to a website (which uses Runway), but upon further inspection we're getting some duplicate pages. These pages aren't duplicated in the admin of Runway, so I don't know where they're duplicating coming from – any ideas?

Here's the link to the sitemap.php: https://www.uk-cpi.com/sitemap.php

In my page (I've added it as a physical page, to avoid it showing up in Pages), I've used this code:

<?php header('Content-type: application/xml');
    include('login/runtime.php');
    perch_pages_navigation(array(
        'template'=>'sitemap.html',
        'flat'=>true
));?>

And this is my sitemap.html template:

<perch:before><?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="https://www.sitemaps.org/schemas/sitemap/0.9"></perch:before>
<url><loc>https://www.uk-cpi.com<perch:pages id="pagePath" /></loc></url>
<perch:after></urlset></perch:after>

Below is my diagnostics report as well:

Perch Runway: 2.8.34, PHP: 5.6.30, MySQL: mysqlnd 5.0.11-dev - 20120503 - $Id: 76b08b24596e12d4553bd41fc93cccd5bac2fe7a $, with PDO
Server OS: Linux, cgi-fcgi
Installed apps: content (2.8.34), assets (2.8.34), categories (2.8.34), collection_5 (2.8.34), collection_2 (2.8.34), collection_1 (2.8.34), collection_9 (2.8.34), collection_6 (2.8.34), collection_14 (2.8.34), collection_11 (2.8.34), perch_forms (1.8.3), collection_12 (2.8.34), collection_4 (2.8.34), collection_10 (2.8.34), collection_13 (2.8.34), collection_19 (2.8.34), collection_8 (2.8.34), collection_3 (2.8.34), collection_7 (2.8.34)
App runtimes: <?php $apps_list = array( 'content', 'categories', 'perch_forms', );
PERCH_LOGINPATH: /login
PERCH_PATH: /home/admin/public_html/login
PERCH_CORE: /home/admin/public_html/login/core
PERCH_RESFILEPATH: /home/admin/public_html/login/resources
Image manipulation: GD
PHP limits: Max upload 200M, Max POST 1024M, Memory: -1M, Total max file upload: -1M
F1: 6a33f95eca3667f9e0c39bf5ca2980fe
Resource folder writeable: Yes
HTTP_HOST: www.uk-cpi.com
DOCUMENT_ROOT: /home/admin/public_html
REQUEST_URI: /login/core/settings/diagnostics/
SCRIPT_NAME: /login/core/settings/diagnostics/index.php
Philip Gwynne

Philip Gwynne 1 points

  • 4 years ago

Are the pages that are duplicated using routes?

Or is it picking up draft / inactive pages in those sections?

It might be worth creating a navigation group called sitemap and then adding the pages/collections you want listing to that manually to see if the duplicates vanish? That way you can have the sitemap page in the page listings too.

No I haven't defined routes for those pages, just a path.

That could be an option though Jonathan Elliman. I'll have an experiment, thanks!

Drew McLellan

Drew McLellan 2638 points
Perch Support

I can't see a direct reason from the information provided.

Simon Clay

Simon Clay 127 points

In case it helps, I have had the same problem with a Perch site.

For me the common factor was that the duplicated url always had sub pages.

I then realised the issue for me: because of the way Bootstrap works, In the page tree in admin, I had created a 'blank' parent page for the bootstrap dropdown toggle, then added child pages to it. Eg:

  • About Us - (Blank parent page - url: /about us)
    • Who We Are - (url: /about us/index.php)
    • Our Team - (url: /about us/our-team.php)
    • Where to find us - (url: /about us/where-to-find-us.php)

Therefore, the About Us url index was being repeated.

EDIT: I have now wrapped the url in the template with an If different statement, to skip it if it's the same as a previous url:

<perch:if different="pagePath">
    <url>
        <loc>https://www.lowesips.com<perch:pages id="pagePath" /></loc>
    </url>
</perch:if>

Thanks Simon! I'll do the same for now.

Interestingly enough, we don't have any blank pages as such but it is only affecting pages that have subpages like you've found – and only pages where Collection items are used for subpages (it doesn't happen to all Collection pages.. but most of them).

Either way, we'll implement this fix for now and see what happens when we move to Runway 3 later to see if that makes a difference. Thanks again!