Implemented ternary operator to simplify page title logic