Giter Site home page Giter Site logo

Comments (3)

kjvarga avatar kjvarga commented on July 16, 2024

You can do it in your sitemap config, right after the create block. Then when you run the rake sitemap:refresh task it will create the sitemap, execute your rsync bit and then ping the search engines (which is done last via a call to SitemapGenerator::Sitemap.ping_search_engines).

That's the easiest way. If you want to break things up into separate rake tasks it's a bit trickier because the ping needs info from the sitemap config. So we would need a separate rake task to do the ping which evals the sitemap config but doesn't recreate the sitemaps. Seems overly complicated.

from sitemap_generator.

alexslade avatar alexslade commented on July 16, 2024

Ah, great tip, thanks.

I think we've got a niche use-case, we have to generate our sitemaps on one server (background rake task) and the sync it to several other servers over the next 15 minutes. Ideally I'd like to delay the ping until after that.

I might just write our own task to ping the search engines based on our files.

from sitemap_generator.

kjvarga avatar kjvarga commented on July 16, 2024

Ok I see. That's probably quite common because you don't want to generate the sitemaps on all your servers. But the good news is that it's actually super easy to do...I forgot that the ping just needs to know the location of the index file, nothing more.

So you can do something like this, borrowing the options you have in your sitemap config:

# rake task, runner or other
SitemapGenerator::Sitemap.host = 'http://example.com'
SitemapGenerator::Sitemap.ping_search_engines # ping http://example.com/sitemap_index.xml.gz

Don't forget to generate your sitemaps with rake sitemap:refresh:no_ping.

from sitemap_generator.

Related Issues (20)

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.