Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
= BigSitemap
BigSitemap is a {Sitemap}[http://sitemaps.org] generator suitable for applications with greater than 50,000 URLs. It splits large Sitemaps into multiple files, gzips the files to minimize bandwidth usage, supports increment updates, can be set up with just a few lines of code and is compatible with just about any framework.
BigSitemap is best run periodically through a Rake/Thor task.
require 'big_sitemap'
include Rails.application.routes.url_helpers # Allows access to Rails routes
BigSitemap.generate(:url_options => {:host => 'example.com'}, :document_root => "#{APP_ROOT}/public") do # Add a static page add '/about'
# Add some URLs from your Rails application
Post.find(:all).each do |post|
add post_path(post)
end
# Add some URLs with additional options
Product.find(:all).each do |product|
add product_path(product), :change_frequency => 'daily', :priority => 0.5
end
end
The code above will create a minimum of two files:
If your sitemaps grow beyond 50,000 URLs (this limit can be overridden with the :max_per_sitemap
option), the sitemap files will be partitioned into multiple files (sitemap_1.xml.gz
, sitemap_2.xml.gz
, ...).
=== Framework-specific Classes
Use the framework-specific classes to take advantage of built-in shortcuts.
==== Rails
BigSiteMapRails
deals with setting the :document_root
and :url_options
initialization options.
==== Merb
BigSitemapMerb
deals with setting the :document_root
initialization option.
== Install
Via gem:
sudo gem install big_sitemap
== Advanced
=== Initialization Options
:url_options
-- hash with :host
, optionally :port
and :protocol
:base_url
-- string alternative to :url_options
, e.g. 'https://example.com:8080/'
:url_path
-- string path_name to sitemaps folder, defaults to :document_path
:document_root
-- string:document_path
-- string document path for sitemaps, relative to :document_root, defaults to empty string (putting sitemap files in the document root directory):document_full
-- string absolute document path to generation folder - defaults to :document_root/:document_path
:max_per_sitemap
-- 50000
, which is the limit dictated by Google but can be less:gzip
-- true
:ping_google
-- true
:ping_yahoo
-- false
, needs :yahoo_app_id
:ping_bing
-- false
:ping_ask
-- false
:ping_yandex
-- false
:partial_update
-- false
=== Change Frequency, Priority and Last Modified
You can control "changefreq", "priority" and "lastmod" values for each record individually by passing them as optional arguments when adding URLs:
add(product_path(product), { :change_frequency => 'daily', :priority => 0.5, :last_modified => product.updated_at })
=== Partial Update
If you enable :partial_update
, the filename will include the id of the first entry. This is perfect to update just the last file with new entries without the need to re-generate files being already there. You must pass the entry's id in when adding the URL. For example:
BigSitemap.generate(:base_url => 'http://example.com', :partial_update => true) do Widget.find_in_batches(:conditions => "id > #{get_last_id}").each do |widget| add widget_path(widget), :id => widget.id end end
== TODO
Tests for framework-specific components.
== Credits
Thanks to Alastair Brunton and Harry Love, who's work provided a starting point for this library.
Thanks also to those who have contributed patches:
== Copyright
Copyright (c) 2010 Stateless Systems (http://statelesssystems.com). See LICENSE for details.
FAQs
Unknown package
We found that big_sitemap demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers 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
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.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.