Project

redde_seo

0.0
No commit activity in last 3 years
No release in over 3 years
SEO for redde rails projects
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies
 Project Readme

Redde Seo

Build Status Code Climate

Seo helper for Redde rails projects

Installation

Add redde_seo to your Gemfile:

gem 'redde_seo'

Mount engine in your routes.rb:

mount ReddeSeo::Engine, at: '/redde/seo'
namespace :admin do
  resources :seos do
    get 'all', on: :collection
  end
end

Install migrations:

rake redde_seo_engine:install:migrations

Migrate database:

rake db:migrate

Usage

Add concern to model:

include WithSeo

Add concern to ApplicationController:

include WithSeoCtrl

Define seo_object method when needed:

# products_controller.rb
...

def seo_object
  return @product if @product
  nil
end

Insert this block in the end of the form (before submit):

...
= render 'admin/seos/block', f: f

= f.submit

Templated Seo

If you want to use templated seo:

Create necessary directory structure:

mkdir -p app/models/redde/seo

Add custom class name to app/models/redde/seo/custom_class_names.rb:

module Redde::Seo::CustomClassNames
  NAMES = ['Product']
end

Create template for your model (Product):

# app/models/redde/seo/product_seo.rb

class Redde::Seo::ProductSeo < Redde::Seo::Template
  def title
    "#{objekt.name.gsub('\r\n', ' ')} hop"
  end

  def description
    "#{title}"
  end

  def keywords
    ''
  end

  def text
    ''
  end
end