Security News
Supply Chain Attack Detected in Solana's web3.js Library
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Enable meta tags in your model
gem "meta_manager"
ActiveRecord:
require 'meta_manager/orm/active_record'
rake meta_manager_engine:install:migrations
Mongoid:
require 'meta_manager/orm/mongoid'
class Category < ActiveRecord::Base
include MetaManager::Taggable
end
@category = Category.new
@category.tag_title = 'category test title'
@category.tag_keywords = "Some keywords"
@category.tag_description = "Some description"
@category.meta_tags.build(:name => "og:title", :content => 'category og:title')
# create dynamic meta tags, who will be overwrited the same category tag names
# only with @meta_dynamic=true in controller
@category.meta_tags.build(:name => "og:title", :content => 'dynamic og:title - %{post.title}', :is_dynamic => true)
@category.meta_tags.build(:name => "title", :content => '%{post.title} - %{post.notes}', :is_dynamic => true)
@category.save
# create post for dynamic example
@post = Post.create(:title => 'post test title', :notes => 'post test notes')
At layouts/application.html.erb
<head>
<%= raw(render_meta_tags(@category)) %>
<title><%= render_page_title(@category) %></title>
At controllers/posts_controller.rb
before_action :find_category
before_action :prepare_dynamic_page, :only => [:show]
def index
@posts = Post.order('id')
respond_with(@posts)
end
def show
@post = Post.find(params[:id])
respond_with(@post)
end
protected
def find_category
@category = Category.first
end
# set @meta_dynamic true to turn on dymanic meta tags.
def prepare_dynamic_page
@meta_dynamic = true
end
It will be generate meta tags and title for @category. In action show we wont to generate dynamic meta tags from instance @post. It means that meta tag 'og:title' and tag 'title' will be overwrited with attributes from instance @post.
Action index:
<meta content='Some keywords' name='keywords' />
<meta content='Some description' name='description' />
<meta content='category og:title' property='og:title' />
<title>category test title</title>
Action show:
<meta content='Some keywords' name='keywords' />
<meta content='Some description' name='description' />
<meta content='dynamic og:title - post test title' property='og:title' />
<title>post test title - post test notes</title>
rake test
Copyright (c) 2012 Fodojo, released under the MIT license
FAQs
Unknown package
We found that meta_manager 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
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.