• Resolved zo

    (@zotezo)


    Hi,
    Each attribute in Yoast gets its own sitemap.When any attribute created then By default one sitemap has been created with that name.
    Can we restrict anyway so that after creations of any attributes will not create any site map in yoast?

    I have seen this code-
    https://yoast.com/help/how-to-customize-the-sitemap-index/#other

    /* Exclude One Taxonomy From Yoast SEO Sitemap */
    function sitemap_exclude_taxonomy( $value, $taxonomy ) {
    if ( $taxonomy == 'taxonomy_slug' ) return true;
    }
    add_filter( 'wpseo_sitemap_exclude_taxonomy', 'sitemap_exclude_taxonomy', 10, 2 );

    I have added one “test”.I have added the above code.
    But still https://dev1.zotezo.com/in/pa_pack-of-sitemap.xml is showing.
    What is the actual code?
    Alternatively is it possible?
    “Show Product Test in search results?” The default option is “yes”, is it possible to make it “no” as the default option for attributes. if it is “no” then attribute will not appear in the sitemap. If we require any attribute in the sitemap, then we will do it manually by changing the option to “yes”
    Thanks

Viewing 15 replies - 1 through 15 (of 16 total)
  • Hi @zotezo,

    Thank you for reaching out.

    When you do create Product Attributes with WooCommerce, you can enable/disable that the attribute gets an archive page. If you enable it, you create an archive page for the attribute. When you enable this, you want the archive page to exist and be found by search engines. Therefore, it gets a sitemap. You can still change the behavior under SEO → Search Appearance → Taxonomies.

    If you don’t want an archive page to be created for the attribute, you can uncheck it in the attribute settings, then it would not be created with Yoast SEO.

    Thread Starter zo

    (@zotezo)

    Hi,
    >>If you don’t want an archive page to be created for the attribute, you can uncheck it in the attribute settings, then it would not be created with Yoast SEO.
    Where is that setting?

    The code that I have sent I have seen this code-
    https://yoast.com/help/how-to-customize-the-sitemap-index/#other
    How to make it work?

    /* Exclude One Taxonomy From Yoast SEO Sitemap */
    function sitemap_exclude_taxonomy( $value, $taxonomy ) {
    if ( $taxonomy == 'taxonomy_slug' ) return true;
    }
    add_filter( 'wpseo_sitemap_exclude_taxonomy', 'sitemap_exclude_taxonomy', 10, 2 );

    I have added but not working..
    Thanks

    • This reply was modified 4 years, 7 months ago by zo.

    Hi @zotezo,

    >>If you don’t want an archive page to be created for the attribute, you can uncheck it in the attribute settings, then it would not be created with Yoast SEO.

    Where is that setting?
    When you go to WooCommerce → Attributes and edit an attribute there is a checkbox Enable this if you want this attribute to have product archives in your store.. If you disable this, you would not have an archive page for the attribute and no sitemap.

    We just tested the filter on a local environment and can confirm the filter does not work with the latest versions. We’ll forward this to the team and get the documentation updated. Thank you!

    Thread Starter zo

    (@zotezo)

    Hi,
    >>We just tested the filter on a local environment and can confirm the filter does not work with the latest versions. We’ll forward this to the team and get the documentation updated.
    When can I expect this Updated code?
    Thanks

    Hi @zotezo,

    Thanks for the reply.

    We are not sure when exactly, we’ve internally logged this and the blog/development team will check and update the code accordingly. We don’t have an ETA on this, I’m afraid.

    Hi @zotezo,

    I was checking this further with the team. The slug name for product attributes need to be prefixed with pa_ in the code snippet and then it does work. So if your attribute is called color, the slug name would need to be pa_color. This is how WooCommerce works by default.

    Sorry to have overseen that. The code still works with the latest Yoast SEO versions. Hope this helps.

    Thread Starter zo

    (@zotezo)

    Hi,
    Is it not possible dynamically?
    When any attribute created then By default no sitemap has been created with that name?

    or,
    “Show Product Test in search results?” The default option is “yes”, is it possible to make it “no” as the default option for attributes. if it is “no” then attribute will not appear in the sitemap. If we require any attribute in the sitemap, then we will do it manually by changing the option to “yes”
    Thanks

    Hi @zotezo,

    Thank you for your reply.

    Let’s step back a bit. As previously mentioned, if you don’t need an archive page, then we just encourage you to disable the checkbox at the attribute stating that you don’t want/need an archive page. Then there is no need to actually change a setting in Yoast. When you want to have them, you enable the checkbox at the attribute in WooCommerce and then the sitemap is created. It’s either way and depends on your needs to have an archive page or not.

    Thread Starter zo

    (@zotezo)

    No, we use content egg to manage our products, some attributes are automatically created by content egg, so it is difficult to check each attribute and edit the archives option. We need “Show attribute in search results?” default option as “No”. This will help us a lot.
    or When any attribute created then By default no sitemap has been created with that name?
    I want any one of the features…

    Thank you for your reply.

    The default when creating a WooCommerce attribute is No as for the checkbox, this means that Content Egg does enable it when it creates attributes. We encourage you to talk to the plugin developers of the Content Egg plugin as we are not familiar with how they interact with WooCommerce. Sorry not to be able to help in this regard.

    Thread Starter zo

    (@zotezo)

    Hi,
    I am very surprised why you are not telling about this?
    https://yoast.com/help/how-to-customize-the-sitemap-index/#other
    Is it not possible dynamically?
    When any attribute created then By default no sitemap has been created with that name?
    Is it not possible to block?

    Thread Starter zo

    (@zotezo)

    Hi,
    Help from your end is highly appreciated…

    Hi @zotezo,

    It should be possible to dynamically exclude any new term in a certain taxonomy from generating a sitemap using the wpseo_sitemap_exclude_taxonomy Yoast developer hooks if implemented correctly.

    Unfortunately, giving you the exact custom code to use is out of the scope of the support we can provide here. We would not want to suggest something that will break your site, so we recommend contacting a developer to give more guidance if you’re not familiar with what code to add for the needs of your site.

    If you believe you’ve found a bug in the Yoast SEO sitemap functions or a conflict with another plugin like Content Egg, you’re welcome to create a new GitHub issue for our developers. Please report the issue to the third-party developer as well.

    Whether a WooCommerce product attribute displays an archive is something that isn’t controlled by Yoast SEO, so you would need to consult the WooCommerce or Content Egg documentation or support.

    Thread Starter zo

    (@zotezo)

    Hi,
    >>It should be possible to dynamically exclude any new term in a certain taxonomy from generating a sitemap using the wpseo_sitemap_exclude_taxonomy Yoast developer hooks if implemented correctly.

    Yes this one https://yoast.com/help/how-to-customize-the-sitemap-index/#other
    But after adding this code in function.php of my child theme nothing is happening
    What is the correct way please help-

    
    /* Exclude One Taxonomy From Yoast SEO Sitemap */
    function sitemap_exclude_taxonomy( $value, $taxonomy ) {
    if ( $taxonomy == 'taxonomy_slug' ) return true;
    }
    add_filter( 'wpseo_sitemap_exclude_taxonomy', 'sitemap_exclude_taxonomy', 10, 2 )

    Thanks

    Plugin Support Michael Ti?a

    (@mikes41720)

    Hello,

    We recommend that you consult with your developer to make sure the filter is working properly for your website.

    Unfortunately, giving you the exact custom code to use is out of the scope of the support we can provide here. We would not want to suggest something that will break your site, so we recommend contacting a developer to give more guidance if you’re not familiar with what code to add for the needs of your site.

    If you believe you’ve found a bug in the Yoast SEO sitemap functions or a conflict with another plugin like Content Egg, you’re welcome to create a new GitHub issue for our developers. Please report the issue to the third-party developer as well.

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘Sitemap has been created with the creation of Attribute’ is closed to new replies.