Skip to content

Commit 5849401

Browse files
committed
Extract shared meta tags to application helper
1 parent d6032c5 commit 5849401

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

app/content/layouts/article.html.erb

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,13 @@
22
title: current_page.data.title!,
33
description: current_page.data.description,
44
keywords: %w[rails hotwire],
5-
index: true,
6-
icon: "/favicon.ico",
75
og: {
8-
title: :title,
9-
description: :description,
106
type: "article",
117
url: current_page.url,
12-
site_name: "Joy of Rails",
13-
locale: "en_US",
148
image: current_page.data.meta_image && asset_url(current_page.data.meta_image)
159
},
1610
twitter: {
1711
card: current_page.data.meta_image ? "summary_large_image" : "summary",
18-
site: "@joyofrails",
1912
}
2013
) %>
2114
<%= render "application/skip_to_content" %>

app/helpers/application_helper.rb

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,19 @@ def seo_meta_tags
66
{rel: "apple-touch-icon", href: "/apple-touch-icon.png?v1.0"},
77
{rel: "manifest", href: "/manifest.webmanifest?v1.0"}
88
]
9+
set_meta_tags index: true
10+
set_meta_tags icon: "/favicon.ico"
11+
set_meta_tags og: {
12+
title: :title,
13+
description: :description,
14+
type: "article",
15+
url: url_for,
16+
site_name: "Joy of Rails",
17+
locale: "en_US"
18+
}
19+
set_meta_tags twitter: {
20+
site: "@joyofrails"
21+
}
922
display_meta_tags site: "Joy of Rails"
1023
end
1124
end

0 commit comments

Comments
 (0)