From df20108ec1ca19924929ea3331c77b02f3adb83b Mon Sep 17 00:00:00 2001 From: Robert Richter Date: Mon, 5 Sep 2016 12:39:14 -0500 Subject: [PATCH] Keep only default data in SEO partial Since the SEO partial will be in every page, we must keep either data that is the same for all pages, or pointers to the data that will be set dynamically in other pages. --- app/views/layouts/_seo.html.erb | 68 ++++++++------------------ app/views/layouts/application.html.erb | 3 +- app/views/main/index.html.erb | 4 +- 3 files changed, 23 insertions(+), 52 deletions(-) diff --git a/app/views/layouts/_seo.html.erb b/app/views/layouts/_seo.html.erb index 508e5c03..88b0805d 100644 --- a/app/views/layouts/_seo.html.erb +++ b/app/views/layouts/_seo.html.erb @@ -1,50 +1,22 @@ <%# This belongs inside the tag %> + - - -<% - # All of these values can be overridden elsewhere by using the set_meta_tags function - - # Make sure description is no longer than 155 characters - site_name = "Notebook" - site_description = "Notebook is a set of tools for writers, game designers, and roleplayers to create magnificent universes, and everything within them." - site_url = request.host - site_image = "http://www.notebook.ai/assets/card-headers/hero-d5161eb41a02535f6656af83cacbdb8c.jpg" - - set_meta_tags description: site_description, - # Recommended keywords tag length: up to 255 characters, 20 words. - keywords: %w[writing author fiction character universe location nanowrimo], - canonical: site_url, - twitter: { - card: "summary", - title: site_name, - url: site_url, - description: site_description, # Page description must be less than 200 characters - creator: "@IndentLabs", - image: { - # Twitter summary card with large image must be at least 280x150px - src: site_image - } - }, - og: { - title: site_name, - type: "website", - url: site_url, - image: site_image, - description: site_description, - site_name: site_name, - } - %> - <%= display_meta_tags %> - +<%# Default values and pointers here only. +Most content should be set in the pages themselves %> +<%= display_meta_tags site: "Notebook", +publisher: "https://plus.google.com/118076966717703203223", +og: { + title: :title, + site_name: "Notebook", + image: :image_src, + url: request.url, + description: :description, +}, +twitter: { + card: "summary", + title: :title, + image: :image_src, + url: request.url, + description: :description +} %> + diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index a2403b01..f181e22b 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -1,7 +1,6 @@ - <%= content_for?(:title) ? yield(:title) : 'Notebook' %> <%= stylesheet_link_tag 'application' %> <%= javascript_include_tag 'application' %> <%= csrf_meta_tags %> @@ -11,7 +10,7 @@ - + <%# is set in _seo.html.erb %> <%= render 'layouts/seo' %> </head> <body> diff --git a/app/views/main/index.html.erb b/app/views/main/index.html.erb index 51181999..c7aff17c 100644 --- a/app/views/main/index.html.erb +++ b/app/views/main/index.html.erb @@ -3,11 +3,12 @@ <div class="card"> <div class="card-image"> <%= image_tag 'card-headers/hero.jpg', width: '100%' %> + <% set_meta_tags image_src: image_url('card-headers/hero.jpg') %> <span class="card-title">Your digital notebook is here.</span> </div> <div class="card-content"> <h4> - Notebook is a set of tools for writers, game designers, and roleplayers to create magnificent universes – and everything within them. + <%= description 'Notebook is a set of tools for writers, game designers, and roleplayers to create magnificent universes – and everything within them.' %> </h4> <p> From a simple interface in your browser, on your phone, or on your tablet, you can do everything you'd ever want to do while creating your own little (or big!) world. @@ -19,4 +20,3 @@ </div> </div> </div> -