SEO Landing Pages

a ruby gem to manage your landing pages in Rails easily

Joaquin Rivera Padron

#hackweekxing

SEO and HTML

  • title
  • meta description
  • meta keywords (to a lesser extent)

SEO: 3 key HTML elements in the  <head>

github.com/joahking/seo-landing-pages

#hackweekxing

seo_landing_pages

This gem lets you easily:

  • create landing pages
  • edit their title, description and keywords
  • render them easily in your views HEAD

github.com/joahking/seo-landing-pages

#hackweekxing

Install

  # in your Gemfile
  gem 'seo_landing_pages'

  $ bundle

github.com/joahking/seo-landing-pages

#hackweekxing

Setup

$ rails g seo_landing_pages setup

 create  db/migrate/20151002132829_create_seo_landing_pages.rb
 insert  app/controllers/application_controller.rb
 create  app/admin/seo_landing_pages.rb
 create  config/locales/seo_landing_pages.en.yml
 create  config/locales/seo_landing_pages.es.yml

github.com/joahking/seo-landing-pages

#hackweekxing

a Rails generator is provided

Setup migration

class CreateSeoLandingPages < ActiveRecord::Migration
  def change
    create_table :seo_landing_pages do |t|
      t.string :slug
      t.string :title
      t.string :description
      t.string :keywords

      t.timestamps
    end
    add_index :seo_landing_pages, :slug
  end
end

github.com/joahking/seo-landing-pages

#hackweekxing

Setup controller

 class ApplicationController < ActionController::Base
+  include SeoLandingPages::Controllers::Helpers
+

A method to find the landing by request path

  • seo_current_landing_page

 

Some helpers for your views (more on it later)

 

 

github.com/joahking/seo-landing-pages

#hackweekxing

Setup Admin area

  • an Active Admin boilerplate code
  • it's locales (english and spanish)

 

 

github.com/joahking/seo-landing-pages

#hackweekxing

Create a Page

SeoLandingPages::Model.create! slug: '/', 
                               title: 'SEO landings FTW'
  • slug: must be given and be unique
  • pages are found by slug (but you can tweak that!)

github.com/joahking/seo-landing-pages

#hackweekxing

Hook your views

  # in the head section
  = seo_landing_page_title_tag
  = seo_landing_page_description_tag
  = seo_landing_page_keywords_tag

create the HTML tags when

  • the page exists
  • and has the data

github.com/joahking/seo-landing-pages

#hackweekxing

I18n support

  # in the head section
  = seo_landing_page_title_tag i18n: true
  = seo_landing_page_description_tag i18n: true
  = seo_landing_page_keywords_tag i18n: true

github.com/joahking/seo-landing-pages

#hackweekxing

SeoLandingPages::Model.create! slug: '/', 
                               title: 'an_i18n_key'

create landings with i18n keys

use helpers with i18n support

translate an_i18n_key in your locales

Advanced

  • find pages not only by request path (check the README)
  • Use the admin area

github.com/joahking/seo-landing-pages

#hackweekxing

Open source

github.com/joahking/seo-landing-pages

 

https://rubygems.org/gems/seo_landing_pages

github.com/joahking/seo-landing-pages

#hackweekxing

Thanks

github.com/joahking/seo-landing-pages

#hackweekxing

SEO Landing Pages

 

 

Joaquin Rivera Padron

SEO Landing Pages

By Joaquin Rivera Padron

SEO Landing Pages

a ruby gem to manage your SEO landing pages in Rails easily

  • 1,654