---
title: "Rails 6.1 adds annotate_rendered_view_with_filenames for views"
description:
  "Rails 6.1 adds ActionView::Base.annotate_rendered_view_with_filenames to
  annotate HTML output"
canonical_url: "https://www.bigbinary.com/blog/rails-6-1-adds-annotate_rendered_view_with_filenames-to-annotate-html-output"
markdown_url: "https://www.bigbinary.com/blog/rails-6-1-adds-annotate_rendered_view_with_filenames-to-annotate-html-output.md"
---

# Rails 6.1 adds annotate_rendered_view_with_filenames for views

Rails 6.1 adds ActionView::Base.annotate_rendered_view_with_filenames to
annotate HTML output

- Author: Akhil Gautam
- Published: July 29, 2020
- Categories: Rails 6.1, Rails

Rails 6.1 makes it easier to debug rendered HTML by adding the name of each
template used.

#### Rails 6.1

Add the following line in `development.rb` file to enable this feature.

```ruby
config.action_view.annotate_rendered_view_with_filenames = true
```

Now the rendered HTML will contain comment indicating the beginning and end of
each template.

Here is an example.

![Annotated HTML output](https://www.bigbinary.com/blog/images/images_used_in_blog/2020/rails-6-1-adds-annotate_rendered_view_with_filenames-to-annotate-html-output/annotate_html_with_template_name.png)

In the image we can see the `begin` and `end` for each of the templates. It
helps a lot in debugging webpages to find out which template is rendered. Check
out the [pull request](https://github.com/rails/rails/pull/38848) for more
details on this.

## Links

- [Human page](https://www.bigbinary.com/blog/rails-6-1-adds-annotate_rendered_view_with_filenames-to-annotate-html-output)
