
Research
/Security News
DuckDB npm Account Compromised in Continuing Supply Chain Attack
Ongoing npm supply chain attack spreads to DuckDB: multiple packages compromised with the same wallet-drainer malware.
#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.
Research
/Security News
Ongoing npm supply chain attack spreads to DuckDB: multiple packages compromised with the same wallet-drainer malware.
Security News
The MCP Steering Committee has launched the official MCP Registry in preview, a central hub for discovering and publishing MCP servers.
Product
Socket’s new Pull Request Stories give security teams clear visibility into dependency risks and outcomes across scanned pull requests.