• Resolved coolicious

    (@coolicious)


    Hey TSF-guys,

    I need your help. I have a problem which only Yoast can fix right now but I dont want to change the plugin if you can help me.

    I want to switch all my custom added taxonomies like “artists”, “genre”, “showrunner” from “index” to “noindex” to clean up my crawlabilty and stuff.

    Yoast have very easy checkbox to do this – how can I do that with TSF?

    Thanks in advance!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Sybre Waaijer

    (@cybr)

    Hello!

    We haven’t gotten that far yet. The v3.1 & v4.0 updates brought post type settings, and the v4.1 or v4.2 update will bring taxonomy-and term specific settings. We also need these options for our websites, so you can expect it to be fully-fledged and field-tested ??

    Until then, you can achieve what you need via filters. We have one in our filter docs already, but here’s one that more easily manageable with your setup:

    add_filter( 'the_seo_framework_robots_meta_array', function( $meta, $args, $ignore ) {
    
    	$taxonomy = null === $args
    		? the_seo_framework()->get_current_taxonomy()
    		: ( isset( $args['taxonomy'] ) ? $args['taxonomy'] : '' );
    
    	// Set taxonomies to deindex in this array.
    	$noindex_taxonomies = [
    		'artists',
    		'genre',
    		'showrunner',
    	];
    
    	if ( in_array( $taxonomy, $noindex_taxonomies, true ) ) {
    		$meta['noindex'] = 'noindex';
    	}
    
    	return $meta;
    }, 10, 3 );

    Of course, you can manage all but CPTA pages already via The SEO Framework interface–albeit a bit cumbersome in some situations.

    I hope this helps! Cheers ??

    Thread Starter coolicious

    (@coolicious)

    Hey Sybre,

    thanks for your help!

    I put your code into my child-theme functions.php but it doesnt change anything :/

    What should I do?

    Plugin Author Sybre Waaijer

    (@cybr)

    Hey!

    You’ll need to exchange the $noindex_taxonomies array entries with the taxonomy names. I guessed the names based on your question, but the human-readable names don’t always reflect the registered taxonomy names.

    Could you send me links of the taxonomies to which you wish to apply noindex (archives, post type archives, etc.)? I can then (hopefully) create a filter for you that works the very first time ??

    I understand you may want to keep the links confidential, so feel free to shoot me an email with the links: https://tsf.fyi/contact.

    Cheers!

    Thread Starter coolicious

    (@coolicious)

    Ok, now it works – I did a mistake, sry ??

    Thank you really!

    I looking forward to the options in the plugin for this!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Switch custom taxonomies from “index” to “noindex”’ is closed to new replies.