Skip to content

Commit 8468216

Browse files
committed
Move page titles and descriptions to content_for
The layout picked titles by controller_name, so every non-gemfiles page, including /home/privacy, got the homepage title and description. Each view now declares its own, with the homepage values as the layout fallback.
1 parent 476d055 commit 8468216

3 files changed

Lines changed: 8 additions & 7 deletions

File tree

app/views/gemfiles/show.html.erb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
<% content_for :title, "Audit Tool - Report ##{@alpha_id}" %>
2+
<% content_for :description, "Report ##{@alpha_id} - #{@vulnerabilities_count} Vulnerabilities found on your file" %>
3+
14
<% content_for :script do %>
25
<script>
36
$('html, body').animate({

app/views/home/privacy.html.erb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
<% content_for :title, "Privacy Policy | FastRuby.io Audit Tool" %>
2+
<% content_for :description, "How the FastRuby.io Audit Tool collects, uses, and protects information about you." %>
3+
14
<div class="header" id="header_privacy">
25
<h1>Privacy Policy</h1>
36
</div>

app/views/layouts/application.html.erb

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
11
<!DOCTYPE html>
22
<html lang="en">
33
<head>
4-
<% if controller_name == 'gemfiles' %>
5-
<title>Audit Tool - Report #<%= @alpha_id %></title>
6-
<meta name="description" content="Report #<%= @alpha_id %> - <%= @vulnerabilities_count %> Vulnerabilities found on your file"/>
7-
<% else %>
8-
<title>Free Gemfile.lock Vulnerability Scanner | FastRuby.io</title>
9-
<meta name="description" content="Upload your Gemfile.lock to find vulnerabilities in your application"/>
10-
<% end %>
4+
<title><%= content_for?(:title) ? yield(:title) : 'Free Gemfile.lock Vulnerability Scanner | FastRuby.io' %></title>
5+
<meta name="description" content="<%= content_for?(:description) ? yield(:description) : 'Upload your Gemfile.lock to find vulnerabilities in your application' %>"/>
116

127

138
<%= csrf_meta_tags %>

0 commit comments

Comments
 (0)