add nav class, extract script from template tag