GetSimple Support Forum
Automatic ping to search engines - Printable Version

+- GetSimple Support Forum (http://get-simple.info/forums)
+-- Forum: GetSimple (http://get-simple.info/forums/forumdisplay.php?fid=3)
+--- Forum: GS Development Testing - (alpha/beta) (http://get-simple.info/forums/forumdisplay.php?fid=14)
+--- Thread: Automatic ping to search engines (/showthread.php?tid=2624)



Automatic ping to search engines - Carlos - 2012-01-18

I like the new automatic sitemap generation (though it'd be nice being able to disable it, via gsconfig or setting), but I honestly think that pinging SEs by default is not a good idea. I didn't know about this new feature, and found that one of my 3.1 test sites was quickly indexed by Google.

Not a problem for me, I will just delete my site, but If you are developing a new site for a client or just trying GS, and forget to (or don't know you have to) enable GSDONOTPING, it will probably be involuntarily indexed.


Automatic ping to search engines - ccagle8 - 2012-01-18

I think I agree with you. before since you actually had to manually generate your sitemap, it was known that you were pinging search engines. now that it's automatic, I am changing gsconfig to turn it off by default.

Thanks Carlos!


Automatic ping to search engines - Connie - 2012-01-18

maybe that could become a setting in the "general settings section" and maybe the names of the search engines could be listed ... in a future version of GS ;=)


Automatic ping to search engines - polyfragmented - 2012-01-19

Thanks for the heads up, Carlos and Chris for not activating the auto ping after installation!


Automatic ping to search engines - Carlos - 2012-01-19

Like Connie, I think it would be great to have this in backend settings. Some checkbox(es), like:

Code:
[ ] Ping search engines when site updated

or even greater:

Code:
[x] Generate sitemap when site updated
[ ] Ping search engines automatically

The second checkbox could be hidden if the first is unchecked.

But anyway this could be left for GS 3.2 (or 3.1.1...)


Automatic ping to search engines - ccagle8 - 2012-01-19

i agree... lets put that on the roadmap for 3.2


Automatic ping to search engines - n00dles101 - 2012-03-30

Added this to the issue tracker


Automatic ping to search engines - Carlos - 2012-03-30

(Besides what I suggested in post 5 in this thread)

- I'd suggest to be able to disable the sitemap generation with a new gsconfig setting, e.g. GSNOSITEMAP

- Another possibility is stuffing all the sitemap code into a plugin, to be bundled with GS, so if you don't need it you just disable or remove the plugin.

Either of those would also let other plugins -like I18N- generate their own special sitemap, or allow creation of custom sitemap plugins...


Automatic ping to search engines - ccagle8 - 2012-03-30

i dont see why you don't want the sitemap to be generated? If you dont use it, then dont use it... the generation (once the code is fixed to not recreate it once per file) doesnt take very much overhead.


Automatic ping to search engines - Carlos - 2012-04-07

ccagle8 Wrote:i dont see why you don't want the sitemap to be generated? If you dont use it, then dont use it... the generation (once the code is fixed to not recreate it once per file) doesnt take very much overhead.

Sorry, I have to disagree with you. Even with that code fixed (and even making it use internal page caching instead of reading all xml files), it's not only that small overhead, but also doing an unnecessary file write to disk.

But anyway, let's leave this aside for a moment: What about my last paragraph? (custom sitemap plugins, etc.)


Automatic ping to search engines - mvlcek - 2012-04-08

I'll add here other things I've noticed with sitemap generation:
  • the sitemap actions are useless (see here)
  • action changedata-aftersave is executed BEFORE generate_sitemap, page-delete AFTER generate_sitemap
  • there is no action when restoring backed up pages - it would be needed to generate custom sitemaps.



Automatic ping to search engines - mvlcek - 2012-04-08

@Carlos: I18N now generates a sitemap (in most cases), see here.

@ccagle8, n00dles101: it's easy in 3.0 (just change the link of the "Generate Sitemap" menu), but nearly impossible in 3.1: e.g.
  • for page save I use the changedata-aftersave action, generate the sitemap, do the same as in changedata.php, but without calling generate_sitemap and die.
  • for page delete and save settings, I regenerate the sitemap correctly afterwards on an action hook
  • for restoring a page there is no hook - I can't generate the correct sitemap in that case.



Automatic ping to search engines - Carlos - 2012-04-08

@ccagle & all

I'd like to add another possibility to those two I suggested in post 8 (this thread):

- Add a hook or filter at the beginning of function generate_sitemap(), that returns without generating the sitemap if some condition is met.

For example:

Code:
function generate_sitemap() {
    global $nositemap;
    $nositemap = FALSE;
    exec_action('before-sitemap'); // a plugin could set $nositemap to TRUE here
    if ($nositemap) return TRUE;
    
    // ... GS code for generating the sitemap

(Possibly there's a better way to do this...)

(Edit: typo fix)


Automatic ping to search engines - Carlos - 2012-04-12

mvlcek Wrote:for page save I use the changedata-aftersave action, generate the sitemap, do the same as in changedata.php, but without calling generate_sitemap and die.
Clever way of patching without changing the core! :-)

But replacing/customizing/removing the sitemap it shouldn't be so complicated...


Automatic ping to search engines - Carlos - 2012-04-12

More or less the same as in post #13, but using a new filter (instead of an action):

Code:
function generate_sitemap() {
    $nositemap = exec_filter('replace-sitemap',FALSE); // a plugin could return TRUE here
    if ($nositemap) return TRUE;
    
    // ... GS code for generating the sitemap

Opinions? Better than a GSNOSITEMAP gsconfig setting as I also suggested?


Automatic ping to search engines - shawn_a - 2012-04-19

Carlos Wrote:More or less the same as in post #13, but using a new filter (instead of an action):

Code:
function generate_sitemap() {
    $nositemap = exec_filter('replace-sitemap',FALSE); // a plugin could return TRUE here
    if ($nositemap) return TRUE;
    
    // ... GS code for generating the sitemap

Opinions? Better than a GSNOSITEMAP gsconfig setting as I also suggested?


Instead of all that, maybe just use a global for the sitemap itself (xml or array or object), before creating it, call the hook, if after the hook the global is no longer empty then something already made a sitemap for us so we exit.

Also i think exec_action uses call_user_func which is anonymous and will never get the return value, actually since exec action loops its not possible to even have a return, or else it would break the loop.


Automatic ping to search engines - Carlos - 2012-04-19

shawn_a Wrote:Instead of all that, maybe just use a global for the sitemap itself (xml or array or object), before creating it, call the hook, if after the hook the global is no longer empty then something already made a sitemap for us so we exit.

Yes, that's another possibility. A 'replace-sitemap' hook or filter.

I've sometimes thought about that, I intended to suggest someday a new type of hook/filter, not only for this sitemap thing, but for template tags like get_navigation, get_page_title, get_content, etc. Something like 'replace-navigation', 'replace-content', etc. GS would check if, after being executed, the corresponding global variable has some value, then stop if it has. This way plugins could customize those tags' outputs without needing to change anything in a typical default template (to make all this easier)


RE: Automatic ping to search engines - Carlos - 2014-02-01

Since GS 3.3.0 there is a 'sitemap' filter.


RE: Automatic ping to search engines - likoud - 2015-05-20

Why don't like auto pinging google when new post created?