marsouma
Occasional Observer

Find pages in green tree which have no connection to blue tree

Hi,

since our CMS project is getting bigger and bigger, unfortunately our editors lost control of which pages are currently online and which not.

Every question is SiteArchitect related.

They asked us now for a possibility, to search for pages in the green tree, which have no connection to a blue tree page (so all pages which will not be generated).

Can we do this somehow?

This would help us cleaning up the mess really much.

And since this is somehow related, is there maybe also a possibility to search for all medias (yellow tree) which are not used anywhere?

We tried to achieve this via the extended search, but were not successful.

Thanks in advance,

Marco

3 Replies
bIT_sosswald
Returning Responder

Hi Marco,

take a look into the API documentation for Page (FirstSpirit Access-API) there you will see that a Page is implementing StoreElement (FirstSpirit Access-API) and StoreElement provides some methods like "getOutgoingReferences()", "getIncomingReferences()" and also "hasIncomingReferences()".

With that methods you can see where a StoreElement is used (incoming references) and what other elements it uses (outgoing references).

The same should work for media files.

So you should be able to write a script / module which checks which elements are used and which are not.

But you must take into consideration, that (as far as i know) this methods will not return a value, when e.g. a media is referenced hard coded directly in the template code such as $CMS_REF(media:"media_uid")$.

Greetings

Sandro

Julia1
I'm new here

Hi Marco,

another idea for editors to find pages that are not being used or generated could be the following:

1. Go to the green tree pages

2. Right click on a page opens the menue

3. Choose "Extras" and then "Show usages" (or use Ctrl+U)

Then either a new window appears which shows you the connection to a blue tree page – now you know if the page is generated and in use – or you get the message "No use found". Then you know that this page is not generated and the page can for example be removed.

The contra of this method is that it is slower compared with using a script (as sandro suggested). The pro is that every editor can do this on his / her own.

May depend on how many pages you have in your project.

Good luck!

0 Kudos

Hi Sandro,

hardcoded references are indeed evaluated if they are "simple" which means they do not use expressions or variables.

Example:

$CMS_REF(media:"my_picture")$

... will create an entry in the reference graph (CTRL+R), while

$CMS_REF(media:"my_"+"picture")$

will not.

That‘s the reason why I always strongly advise against using things like

$CMS_REF(media:"flag_"+#global.language.abbreviation.toLowerCase)$

Michael