Support » Plugin: XML Sitemap & Google News » Multilingual website with qTranslate X

  • Resolved ai1dro0knotbot



    I’m using your astonishing plugin, but I was lacking capacity to complain google rel=”alternate” demands.

    So I added this portion of code to feed-sitemap-post_type.php

    ~ line 22
    $enabled_languages = get_option('qtranslate_enabled_languages');        // AG: 
    ~ line 54-66
    	$thisUrl = esc_url( get_permalink() );                            // AG: 
    		<loc><?php echo $thisUrl;                                     // AG: 
        for ($lngCnt=1; $lngCnt<count($enabled_languages); $lngCnt++) {   // AG: 
    			<xhtml:link rel="alternative"  hreflang="<?php echo $enabled_languages[$lngCnt]; ?>" href="<?php echo qtranxf_convertURL($thisUrl, $enabled_languages[$lngCnt]); ?>"/>
        }                                                                 // AG: 

    Now it generates alternate links as google wants to see.
    Reference manual here.

    I’m not too deep into MVC programming, so I did temporary workaround. It would be pleasure if you could add such ability to whole plugin in your professional way.

    Thank you in advance.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi, thanks for sharing that 🙂

    Question: does qTranslate X not add tags like <link rel="alternate" hreflang="lang_code" href="url_of_page" /> in the page headers? If so, adding rel:alternative tags in the sitemap should not really be needed. Or did you experience otherwise?

    Thread Starter ai1dro0knotbot


    qTranslate X added the following:

    <link hreflang="es" href="" rel="alternate" />
    <link hreflang="x-default" href="" rel="alternate" />

    With it’s language switching menu.

    I want my sitemap to match search engine requirements. As far as I see, google pretty strictly enforces own guidelines.

    Thread Starter ai1dro0knotbot


    Today google noticed, that directive
    Should be added also.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Multilingual website with qTranslate X’ is closed to new replies.