• Hello,

    We have submitted the below sitemap to Search Console, but Google is coming back and telling us that category-sitemap.xml and post_tag-sitemap.xml contain invalid URLs. When you compare say page-sitemap.xml with one of be above, you can see that it contains full absolute paths while the former files contain relative paths. Chrome has no problem opening either links, but Search Console doesn’t seem to like the relative ones.

    I don’t understand why this is an issue, though. We have a fairly standard setup (albeit we’re using multisite) and Search Console is something Yoast should be configured to function well with. What am I missing?

    Thanks for any help you can provide!
    Luke

    https://www.digitaldocrepair.com/sitemap_index.xml

Viewing 6 replies - 1 through 6 (of 6 total)
  • Sa?a

    (@stodorovic)

    Hello,

    I’ve a lot of experience related to sitemaps. I think that’s consequence of changing absolute to relative URL by some filter (I saw your HTML code). Do you use plugin or code for it?

    If you send me mote details (plugins, custom code, …), I’ll try to help you.

    Sa?a

    (@stodorovic)

    @fivedigitlp

    It seems that you have custom filter term_link which strips hostname from URL. It isn’t good approach and it isn’t issue in Yoast SEO.

    Similar issues on githib:

    https://github.com/Yoast/wordpress-seo/issues/2441

    So, if you send me more info, I want to help you to find better solution

    Thread Starter Luke Pinion

    (@fivedigitlp)

    What leads you to believe that term_link is being used? This is being used on a custom coded theme and I personally coded the majority of it, but can’t recall using that anywhere. I’ll look through and see what I can find, though.

    Sa?a

    (@stodorovic)

    I found couple issues in the sitemaps. On github is better support related to coding and we can ask Yoast member to confirm my opinion. I see that you are advanced user and I recommend to you open issue on github.

    Basically, class-taxonomy-sitemap-provider.php uses default wp api – get_term_link which triggers filter term_link.
    https://github.com/Yoast/wordpress-seo/blob/trunk/inc/sitemaps/class-taxonomy-sitemap-provider.php#L216

    Advice related to filter:

    
    add_filter( 'term_link', 'custom_term_url' );
    
    function custom_term_url( $url ) {
       if (  ! ( empty( get_query_var( 'sitemap' ) ) && empty(get_query_var( 'sitemap_n' ) ) ) )  return $url;
       .....
    }
    

    PS. This code isn’t tested for syntax errors, I quickly wrote down this to you see how to avoid changing of urls in sitemaps.

    PPS. I see relative URLs in HTML and it’s possible that some plugin (cache or whatever) adds these filters. If plugin is reason, we can fix code and try to report issue to plugin author

    • This reply was modified 8 years, 3 months ago by Sa?a.
    Thread Starter Luke Pinion

    (@fivedigitlp)

    @stodorovic

    I’m sorry–what is that custom code supposed to do? I think I missed that. Also, could you give me specific examples on where you’re seeing relative URLs in the HTML? There are places in the code where I wrote in relative URLs, but this shouldn’t affect how the dynamically generated links in the sitemaps display and I don’t think we have any plugins that would be affecting this either.

    I’m perfectly happy to have your help, but what information specifically do you think would be beneficial for me to pass along to you? A list of plugins? I don’t have many other ideas…

    Sa?a

    (@stodorovic)

    I didn’t use right terminology (WP uses relative URL, but it isn’t real relative URL). So, I’m correcting myself:

    https://www.example.com/test/example/example1

    It’s absolute URL and /test/example/example1 is absolute path. Relative URL can’t start with slash. Sorry for confusing, I saw that you have code or plugin which change URLs from absolute URLs to absolute paths (it removes https://www.eaxmple.com from all URLs). I’m checking all details now.

    eg. https://www.digitaldocrepair.com/5-epic-cell-phone-disasters/

    <ul role="menu" class=" dropdown-menu">
    	<li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-3116"><a title="Corporate News" href="/category/corporate-news/">Corporate News</a></li>
    	<li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-4126"><a title="Franchising" href="/category/franchising/">Franchising</a></li>
    	<li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-3117"><a title="Industry News" href="/category/industry-news/">Industry News</a></li>
    	<li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-3118"><a title="Technology Hacks" href="/category/technology-hack/">Technology Hacks</a></li>
    	<li class="menu-item menu-item-type-taxonomy menu-item-object-category current-post-ancestor current-menu-parent current-post-parent menu-item-3119"><a title="Technology Humor" href="/category/technology-humor/">Technology Humor</a></li>
    	<li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-3120"><a title="Technology News" href="/category/technology-news/">Technology News</a></li>
    	<li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-4127"><a title="Technology Reviews" href="/category/technology-reviews/">Technology Reviews</a></li>
    	<li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-3121"><a title="Technology Tips" href="/category/technology-tips/">Technology Tips</a></li>
    </ul>

    Category URLs aren’t absolute URL, they are absolute paths (if you open category sitemap, you will see same). So, filter term_link exists (I’m guessing that filter uses standard WP function):

    add_filter( 'term_link', 'wp_make_link_relative' );

    https://codex.www.ads-software.com/Function_Reference/wp_make_link_relative

    The quickest way to you find filter is plugin Debug Objects ( https://www.ads-software.com/plugins/debug-objects ). Install plugin, open some page (where are category or tag URLs), click on Objects on admin bar. Open Debug Hooks and try to find filter term_link. You can try to locate plugin/theme/code by function name. Please paste here entire block related to term_link.

    You can send list of plugins, I can try to install all plugins if they are free and try to reproduce your issue.
    I hope that’s helpful.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Invalid URLs in Taxonomy Sitemaps’ is closed to new replies.