With no navigation content several `div` layers are incorrectly closed.

Also merged adjacent `if (navigation)` statements.