You can use $this->template to create conditions for different types of pages, much like WordPress.
if ($this->template == 'question') {
// DO SOMETHING
}
Conditions:
Linked to Navigation
$this->template == 'ask' // Ask Page
$this->template == 'qa' // Homepage / Q&A Page
$this->template == 'activity' // Activity Page
$this->template == 'questions' // Questions List Page
$this->template == 'hot' // Hot Page
$this->template == 'unanswered' // Unanswered Page
$this->template == 'tags' // Tags Page
$this->template == 'categories' // Categories Page
$this->template == 'users' // Users List Page
Single Pages:
$this->template == 'question' // Single Question Page
$this->template == 'custom' // Single Page
$this->template == 'search' // Search Result Page
$this->template == 'user' // Single User Page
Page templates are rendered as a body class in the DOM. You can inspect element to check for other page templates.