Making WordPress.org


Ignore:
Timestamp:
02/11/2021 11:38:15 PM (4 years ago)
Author:
dd32
Message:

o2: noindex all taxonomy archives and empty pages.

Fixes #5617, #5616.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-breathe/functions.php

    r10415 r10661  
    272272
    273273/**
     274 * Noindex some requests:
     275 *  - all o2 taxonomy pages, rather than the default of only noindexing archives with less than 3 posts
     276 *  - Posts/pages/etc with less than 100char.
     277 */
     278function maybe_noindex( $noindex ) {
     279    // Noindex all o2 taxonomy pages.
     280    if ( is_tax() || is_tag() || is_category() ) {
     281        $noindex = true;
     282    }
     283
     284    // Noindex empty/short pages
     285    if ( is_singular() && ( strlen( get_the_content() ) < 100 ) ) {
     286        $noindex = true;
     287    }
     288
     289    return $noindex;
     290}
     291add_filter( 'wporg_noindex_request', __NAMESPACE__ . '\maybe_noindex' );
     292
     293/**
    274294 * Register translations for plugins without their own GlotPress project.
    275295 */
Note: See TracChangeset for help on using the changeset viewer.