Home>Support>Insert hreflang into header for french website

Insert hreflang into header for french website

By Phil, 9 years ago. Last reply by Andrew Misplon, 9 years ago.

Good day SiteOrigin,
This is the first time I post here, I am super pleased with the Vantage premium theme and so far I managed to find every answer I needed using this support forum, until now :-).
I’m setting up a French only website and I am now tweaking SEO using WordPress SEO by Yoast.
Google search console tells me that I have no hreflang and I don’t know where I should place this link…
I need to somehow insert this line to tell Google my site is in french:

 <link rel="alternate" hreflang="fr" href="http://jeuxcyclone.ca"/> 

Any help is very appreciated. Please also confirm if I am not heading in the right direction with this issue, I won’t be offended :-).
Cheers,

URL: http://jeuxcyclone.ca

This is our free support forum. Replies can take several days. If you need fast email support, please purchase a SiteOrigin Premium license.

  1. 9 years, 3 months ago Magus
    Hi, I Work Here

    Hi Phil

    To do this you will be needing to use a child-theme. Please download and activate this plugin

    https://wordpress.org/plugins/child-theme-configurator/

    Then navigate to Tools->Child Themes.

    Please select your current Theme from the list and give your child-theme a unique name in the box below. Then tick the option to Copy Parent Theme Menus, Widgets and other Customizer Options. Once done click the generate button at the bottom.

    Creating the child-theme this way will ensure that your menus and sidebars remain as they are.

    Then navigate to Appearance->Themes and activate your new child-theme.

    Navigate to Appearance->Editor to open the theme file editor and select the theme functions file.

    Please add the following below the line END ENQUEUE PARENT ACTION.

     add_action('wp_head', 'Add_hreflang');
        function Add_hreflang(){    
          echo '<link rel="alternate" hreflang="fr" href="http://jeuxcyclone.ca"/>';
       } 
    

    Save the file and you are done.

    Please let us know how you get on

    Magus

  2. 9 years, 3 months ago Phil

    Hello Magus,

    thank you for the reply…I will try this later this week and let you know how it goes. Thanks for the info!

  3. 9 years, 2 months ago Andrew Misplon
    Hi, I Work Here

    Hi Phil

    Let us know how things progress. We’ll take it from there.

    Cheers :)

Replies on this thread are closed. Please create a new thread if you have a question, or purchase a SiteOrigin Premium license if you need one-on-one email support.

Get The Most Out of SiteOrigin with SiteOrigin Premium

Find Out More