Giter Club home page Giter Club logo

rails-sitemap's Introduction

Sitemap

A simple ruby on rails sitemap generator.

Instalation

Install the gem:

gem install sitemap

Or as a plugin:

rails plugin install git://github.com/viseztrance/rails-sitemap.git

Then create the initial config file:

rails g sitemap:install

Usage

In your sitemap config file, paths can be indexed as follows:

Sitemap::Generator.instance.load :host => "mywebsite.com" do
  path :root, :priority => 1
  path :faq, :priority => 0.5, :change_frequency => "weekly"
  literal "/my_blog" #helpful for vanity urls layering search results
  resources :activities, :params => { :format => "html" }
  resources :articles, :objects => proc { Article.published }
end

Please read the docs for a more comprehensive list of options.

Building the sitemap:

rake sitemap:generate

By default the sitemap gets saved in the current application root path. You can change the save path by passing a LOCATION environment variable or using a configuration option:

Sitemap.configure do |config|
  config.save_path = "/home/user/apps/my-app/shared"
end

Ping search engines:

rake sitemap:ping

Setting defaults

You may change the defaults for either params or search options as follows:

Sitemap.configure do |config|
  config.params_format = "html"
  config.search_change_frequency = "monthly"
end

Large sites

Google imposes a limit of 50000 entries per sitemap and maximum size of 10 MB. To comply with these rules, sitemaps having over 10.000 urls are being split into multiple files. You can change this value by overriding the max urls value:

Sitemap.configure do |config|
  config.max_urls = 50000
end

License

This package is licensed under the MIT license and/or the Creative Commons Attribution-ShareAlike.

rails-sitemap's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.