Skip to content

Commit 9144324

Browse files
stevepolitodesignrafaelfranca
authored andcommitted
Add application-name metadata to application layout
The following metatag will be added to `app/views/layouts/application.html.erb` ```html <meta name="application-name" content="Name of Rails Application"> ``` The `application-name` is a [standard metadata name][smn], and compliments existing app-related metatags. [smn]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta/name
1 parent 4f41c24 commit 9144324

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

railties/CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
* Add `application-name` metadata to application layout
2+
3+
The following metatag will be added to `app/views/layouts/application.html.erb`
4+
5+
```html
6+
<meta name="application-name" content="Name of Rails Application">
7+
```
8+
9+
*Steve Polito*
10+
111
* Use `secret_key_base` from ENV or credentials when present locally.
212

313
When ENV["SECRET_KEY_BASE"] or

railties/lib/rails/generators/rails/app/templates/app/views/layouts/application.html.erb.tt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<title><%%= content_for(:title) || "<%= app_name.titleize %>" %></title>
55
<meta name="viewport" content="width=device-width,initial-scale=1">
66
<meta name="apple-mobile-web-app-capable" content="yes">
7+
<meta name="application-name" content="<%= app_name.titleize %>">
78
<meta name="mobile-web-app-capable" content="yes">
89
<%%= csrf_meta_tags %>
910
<%%= csp_meta_tag %>

railties/test/generators/app_generator_test.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,7 @@ def test_application_names_are_not_singularized
443443
def test_application_name_is_normalized_in_config
444444
run_generator [File.join(destination_root, "MyWebSite"), "-d", "postgresql"]
445445
assert_file "MyWebSite/app/views/layouts/application.html.erb", /content_for\(:title\) \|\| "My Web Site"/
446+
assert_file "MyWebSite/app/views/layouts/application.html.erb", /meta\sname="application-name"\scontent="My Web Site/
446447
assert_file "MyWebSite/config/database.yml", /my_web_site_production/
447448
end
448449

0 commit comments

Comments
 (0)