The sitemap shows disabled pages
Closed this issue · 4 comments
Hi, thanks for this plugin.
I used it to generate my sitemap, but it lists also the items that are disabled. I'd prefer that it is not displayed to search engines.
To reproduce :
- Create a tailor collection
- Add several items
- Publish some, leave others disabled (is_enabled = false)
- Create a page to display the item with the url scheme "my-collection/:slug"
- Create the sitemap entry to list All these entries
I tried to add a condition in the macro, but the Page finder item doesn't return the proper tailor item.
It returns the same strange item for all entries, with a slug equivalent to "my-collection", not the real slug, not the true item data, and not the correct is_enabled value.
I don't know how to go further. Can you help ?
We have reviewed this today using the sitemap implementation with the demo theme. Disabled pages do not appear in the sitemap collection.
Take a look at the following upgrade guide for more details: https://github.com/rainlab/sitemap-plugin/blob/master/UPGRADE.md
Hopefully it helps
I did followed the upgrade guide in the first place. My blueprint and /sitemap.xml page are excatly the same as the ones on your link. This is why I thought it was a global problem, and not specific to my Tailor collections.
But still, the problemem remains, and I don't know how to investigate on it.
My blueprint is this one : terrains.yaml
uuid: [...]
handle: Terrains
type: entry
name: A vendre
drafts: false
primaryNavigation:
label: A vendre
icon: icon-map-pin
order: 2040
fields:
bien:
type: balloon-selector
label: Type de bien
tab: Résumé
options:
Immeuble / Appartement: Immeuble / Appartement
Maison: Maison
Terrain: Terrain
default: Terrain
adresse:
label: Adresse
type: addressfinder
validation: required
tab: Résumé
fieldMap:
street: rue
zip: cp
city: ville
country-long: pays
latitude: latitude
longitude: longitude
description:
label: Description
type: textarea
size: small
tab: Résumé
column: false
image:
label: Image
type: fileupload
mode: image
maxFiles: 1
tab: Résumé
builder:
type: mixin
source: Builder
rue:
label: Ville
type: text
tab: Géolocalisation
cp:
label: Code postal
type: text
span: auto
tab: Géolocalisation
column: true
ville:
label: Ville
type: text
span: auto
tab: Géolocalisation
column: true
pays:
label: Pays
type: text
tab: Géolocalisation
column: false
latitude:
label: Latitude
type: text
span: auto
tab: Géolocalisation
column: false
longitude:
label: Longitude
type: text
span: auto
tab: Géolocalisation
column: false
The second one is unpublished, but it is still listed in the sitemap :
When I print the item object in the sitemap macro, the object returned is this one. Shouldn't it be my Terrain tailor item ?
I don't get why the collection returns unpublished objects in the first place, and why this item object in the sitemap is not mine.
Is there a way to retrive the collection object instead of this list-entry object, so I could put a condition in the macro to exclude unpublished items... ?
Thank you for the detailed report! We were able to replicate this.
This should be fixed in the next patch release (v3.4.6). However, if it still isn't working, please tag my username, and we can take another look.
Update done, problem solved ! Thank-you very much 👍