Check whether content object has 'getExcludeFromNav' method.

Not all objects have the 'getExcludeFromNav' method. For example, dexterity types use a behavior for that (for which you probably have to add a check too once dexterity lands in the core).