
Security News
Follow-up and Clarification on Recent Malicious Ruby Gems Campaign
A clarification on our recent research investigating 60 malicious Ruby gems.
Sitemap Notifier is a Ruby on Rails plugin that, when installed, automatically notifies Google, Bing, and Yahoo of changes to your models, i.e. changes to your sitemap. It also works in conjunction with the dynamic_sitemaps plugin.
In your Gemfile:
gem 'sitemap_notifier'
And run:
$ bundle install
Start by generating an initializer:
$ rails generate sitemap_notifier:install
Then, in config/initializers/sitemap_notifier.rb:
SitemapNotifier::Notifier.configure do |config|
# Set URL to your sitemap. This is required.
# This can also be configured per model basis,
# see https://github.com/lassebunk/sitemap_notifier#per-model-sitemap-url
config.sitemap_url = "http://example.com/sitemap.xml"
# Models that should trigger notification of search engines.
# Default is to trigger on all creates, updates, and deletes.
config.models = [Article, Category]
# Or, if you want to specify on which actions to notify search engines:
config.models = { Article => [:create, :destroy],
Product => :update,
Page => :all }
# Enabled in which environments – default is [:production]
config.environments = [:development, :production]
# Delay to wait between notifications – default is 10 minutes
config.delay = 2.minutes
# Additional urls to ping
config.ping_urls << "http://localhost:3000/ping?sitemap=%{sitemap_url}"
end
Then create or update a model:
Article.create :title => "My New Article"
The search engines are then automatically notified.
After you install and configure the plugin, it'll automatically notify Google, Bing, and Yahoo every time you update a model. After each notification, it'll wait 10 minutes (by default) before notifying again. This is to ensure that for example a batch update won't trigger an equal amount of notifications.
The sitemaps defaults to what you set in SitemapNotifier::Notifier.sitemap_url
. If you want to use a different sitemap URL based on data in your models, you can override the sitemap_url
method of each of your models like this:
class Product < ActiveRecord::Base
belongs_to :site
def sitemap_url
"http://#{site.domain}/sitemap.xml"
end
end
You can decide on model level whether the search engines should be pinged by overriding the notify_sitemap?
method of your models:
class Product < ActiveRecord::Base
belongs_to :site
def notify_sitemap?
site.id == 1
end
end
Copyright © 2010-2013 Lasse Bunk, released under the MIT license
FAQs
Unknown package
We found that sitemap_notifier 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 clarification on our recent research investigating 60 malicious Ruby gems.
Security News
ESLint now supports parallel linting with a new --concurrency flag, delivering major speed gains and closing a 10-year-old feature request.
Research
/Security News
A malicious Go module posing as an SSH brute forcer exfiltrates stolen credentials to a Telegram bot controlled by a Russian-speaking threat actor.