Skip to content

Commit abb7035

Browse files
authored
Merge pull request rails#54257 from stevepolitodesign/sp-application-name
Add `application-name` metadata to application layout
2 parents 4f41c24 + 9144324 commit abb7035

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)