add permalink handling in controller