![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
#ZEN_SEO is a clean way of managing your meta tags for resources
Hope all of us are at least on Rails3 and moving to upcoming Rails4(unsupported for now)
# Gemfile
gem 'zen_seo'
Then run the install generator, that will create migration(MongoDB is on the routemap) for the SEO model.
rails generate zen_seo:install
Pick up a resource to grant a promotable behavior
#app/models/post.rb
has_seo
This will try to call title
, description
, keywords
on your model to fill in seo fields, optionally you can supply a hash, that redefines the methods to be called
#app/models/post.rb
class Post < ActiveRecord::Base
attr_accessible :body, :tags, :title
has_seo :description=>:body, :keywords=>:make_keywords
private
def make_keywords
self.tags.gsub(/:/, ', ')
end
end
Note that you can pass excessive options that meta_tags support through :options key like so:
#app/models/post.rb
class Post < ActiveRecord::Base
attr_accessible :body, :tags, :title
has_seo :description=>:body,
:options=>{
:og => {
:title => :title,
:type => 'website',
:image => 'http://now.com/you_rock.jpg'
}
}
end
###Controller
ZEN_SEO heavily based on meta_tags gem, so set it up as normal.
When your layout contains
#application.html.erb
<head>
<%= display_meta_tags default_meta_tags %>
</head>
now in controller you can use meta_tags_for
helper
#posts_controller.rb
# GET /posts/1
# GET /posts/1.json
def show
@post = Post.find(params[:id])
meta_tags_for @post
respond_to do |format|
format.html # show.html.erb
format.json { render json: @post }
end
end
###Form
To set meta tags for your resource just put fields_for :seo
in your form. Like this:
<h3>Make yout post seo-friendly</h3>
<%= f.fields_for :seo do |seo| %>
<div class="field">
<%= seo.label :title %><br />
<%= seo.text_field :title %>
</div>
<div class="field">
<%= seo.label :keywords %><br />
<%= seo.text_field :keywords %>
</div>
<div class="field">
<%= seo.label :description %><br />
<%= seo.text_area :description %>
</div>
<% end %>
Developed by Sergey Prikhodko Copyright (c) 2013. See LICENSE for details.
FAQs
Unknown package
We found that zen_seo demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.