Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Michaël Vanbrabandt 863 posts 3348 karma points c-trib
    Dec 08, 2016 @ 12:47
    Michaël Vanbrabandt
    0

    Ping Google after publish

    Hi all,

    anyone that knows how to ping google with a new sitemap after publishing a content node?

    Hooking into the publish event and then call the google ping url:

    http://www.google.com/webmasters/sitemaps/ping?sitemap=[your sitemap web address]
    

    /Michaël

  • ianhoughton 281 posts 605 karma points c-trib
    Dec 08, 2016 @ 13:24
    ianhoughton
    0

    Have you checked these links out?

    Umbraco Content Service events

  • Michaël Vanbrabandt 863 posts 3348 karma points c-trib
    Dec 08, 2016 @ 13:49
    Michaël Vanbrabandt
    0

    Yes I know about the events but its the ping piece that I have trouble with of how to do this inside these events.

    /Michaël

  • Sven Geusens 169 posts 881 karma points c-trib
    Dec 08, 2016 @ 14:29
    Sven Geusens
    101

    Since its an url, I think you just need to make a httprequest.

    There are multiple ways to do this in C#, one of them is the following

    var httpWebRequest = (HttpWebRequest)WebRequest.Create(new Uri("http://www.google.com/webmasters/sitemaps/ping?sitemap=[your sitemap web address]"));
    httpWebRequest.ContentType = "text/json";
    httpWebRequest.Method = "GET";
    httpWebRequest.GetResponse();
    

    There are async variant available. Another way is using the HttpClient

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies