<commit_before>= Active Admin Seo

Add friendly_id and SEO meta fields to your ActiveAdmin resources.

== Installation

Gemfile:

  gem 'activeadmin-seo', github: 'nebirhos/activeadmin-seo'
  gem "activeadmin-dragonfly", github: "stefanoverna/activeadmin-dragonfly"

Install and migrate:

  rake activeadmin_seo:install:migrations
  rake db:migrate

== Usage

app/models/page.rb:

  class Page < ActiveRecord::Base
    attr_accessible :title, :content
    has_seo_meta :title
  end

app/admin/page.rb:

  ActiveAdmin.register Page do
    form do |f|
      # ...
      f.seo_meta_inputs
      # ...
    end
  end

== Model options

Default options
  has_seo_meta :field, tree: false, as: nil

Assign a role for editing Meta:
  has_seo_meta :field, as: :admin

Adds url helper methods (see Nested Routes Handling below):
  has_seo_meta :field, nested: true

== Form helper options

Default options
  f.seo_meta_inputs slug_url_prefix: nil, open_graph_metas: false, basic_metas: false

Include *all* basic metas fields (title/description/keywords)
and *all* open graph metas fields (title/type/url/image)
  f.seo_meta_inputs basic_metas: true, open_graph_metas: true

Include only basic metas title/description fields
and open graph meta title/image fields
  f.seo_meta_inputs basic_metas: [:title, :description],
                    open_graph_metas: [:title, :image]

  f.seo_meta_inputs basic_metas: ['title', 'description'],
                    open_graph_metas: ['title', 'image']

  f.seo_meta_inputs basic_metas: {
                      title: true,
                      description: true
                    },
                    open_graph_metas: {
                      title: true,
                      image: true
                    }


== View Helpers

  <%= seo_meta_tags(@page.seo_meta, title: page.title) %>



== Nested Routes Handling

Often you need to route objects organized as a tree (eg. a Page
resource). To simplify the routes management ActiveAdmin Seo provides
these methods:

app/controllers/pages_controller.rb:

   def show
     @page = Page.find_by_url params[:url]
     render text: @page.url # "/path/to/my/page"
   end

config/routes.rb:

   get "*url" => "pages#show", constraints: ActiveAdmin::Seo::Routes.new(Page)


So a request to "/about/page" finds the page with slug "page" and
parent slug "about", but a request to "/about/non-existent/page"
renders a 404 error without calling the controller.


== Globalize3

You can use it with activeadmin-globalize3, just put the directive in
the active_admin_translates block:

app/models/page.rb:

  class Page < ActiveRecord::Base
    active_admin_translates :title, :content do
      has_seo_meta :title
    end
  end

app/admin/page.rb:

  ActiveAdmin.register Page do
    form do |f|
      # ...
      f.translated_inputs do |t|
        t.input :title
        t.input :content
        # ...
        f.seo_meta_inputs
      end
      # ...
    end
  end

== Copyright

Copyright (c) 2012 <NAME>, Cantiere Creativo
See the file MIT-LICENSE for details.<commit_msg>Fix typo in README for translated_inputs<commit_after>= Active Admin Seo

Add friendly_id and SEO meta fields to your ActiveAdmin resources.

== Installation

Gemfile:

  gem 'activeadmin-seo', github: 'nebirhos/activeadmin-seo'
  gem "activeadmin-dragonfly", github: "stefanoverna/activeadmin-dragonfly"

Install and migrate:

  rake activeadmin_seo:install:migrations
  rake db:migrate

== Usage

app/models/page.rb:

  class Page < ActiveRecord::Base
    attr_accessible :title, :content
    has_seo_meta :title
  end

app/admin/page.rb:

  ActiveAdmin.register Page do
    form do |f|
      # ...
      f.seo_meta_inputs
      # ...
    end
  end

== Model options

Default options
  has_seo_meta :field, tree: false, as: nil

Assign a role for editing Meta:
  has_seo_meta :field, as: :admin

Adds url helper methods (see Nested Routes Handling below):
  has_seo_meta :field, nested: true

== Form helper options

Default options
  f.seo_meta_inputs slug_url_prefix: nil, open_graph_metas: false, basic_metas: false

Include *all* basic metas fields (title/description/keywords)
and *all* open graph metas fields (title/type/url/image)
  f.seo_meta_inputs basic_metas: true, open_graph_metas: true

Include only basic metas title/description fields
and open graph meta title/image fields
  f.seo_meta_inputs basic_metas: [:title, :description],
                    open_graph_metas: [:title, :image]

  f.seo_meta_inputs basic_metas: ['title', 'description'],
                    open_graph_metas: ['title', 'image']

  f.seo_meta_inputs basic_metas: {
                      title: true,
                      description: true
                    },
                    open_graph_metas: {
                      title: true,
                      image: true
                    }


== View Helpers

  <%= seo_meta_tags(@page.seo_meta, title: page.title) %>



== Nested Routes Handling

Often you need to route objects organized as a tree (eg. a Page
resource). To simplify the routes management ActiveAdmin Seo provides
these methods:

app/controllers/pages_controller.rb:

   def show
     @page = Page.find_by_url params[:url]
     render text: @page.url # "/path/to/my/page"
   end

config/routes.rb:

   get "*url" => "pages#show", constraints: ActiveAdmin::Seo::Routes.new(Page)


So a request to "/about/page" finds the page with slug "page" and
parent slug "about", but a request to "/about/non-existent/page"
renders a 404 error without calling the controller.


== Globalize3

You can use it with activeadmin-globalize3, just put the directive in
the active_admin_translates block:

app/models/page.rb:

  class Page < ActiveRecord::Base
    active_admin_translates :title, :content do
      has_seo_meta :title
    end
  end

app/admin/page.rb:

  ActiveAdmin.register Page do
    form do |f|
      # ...
      f.translated_inputs do |t|
        t.input :title
        t.input :content
        # ...
        t.seo_meta_inputs
      end
      # ...
    end
  end

== Copyright

Copyright (c) 2012 <NAME>, <NAME>
See the file MIT-LICENSE for details.
{'fraction_non_alphanumeric': 0.09156311314584696, 'fraction_numerical': 0.0029431000654022237, 'mean_word_length': 2.820737039350406, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '443905', 'n_tokens_mistral': 2015, 'n_tokens_neox': 1917, 'n_words': 577}