encode urls for template context