[Resolved] Hreflang tags created with Elements not appearing

Home Forums Support [Resolved] Hreflang tags created with Elements not appearing

Home Forums Support Hreflang tags created with Elements not appearing

Viewing 15 posts - 1 through 15 (of 16 total)
  • Author
    Posts
  • #1474377
    David

    Hi,

    I’ve recently implemented hreflang tags across a pair of sites (added to private info), both using GP premium.

    I’ve used Elements – wp-head, to add them and it has worked on all pages and posts with the exception of:

    homepage
    /built-from-scratch/

    The pages on which they appear properly and those on which they don’t are the same on the two sites.

    Could you have a look for me? I’ll also include login details.

    #1474434
    David

    Ha!

    Solved it!

    Those two pages are my home page and my blog page. It turns out in Elements’ Display Rules there are specific locations for ‘Front Page’ and ‘Blog’. I’d been using ‘Page’ for all, and then selecting the relevant page from the dropdown.

    All working fine now.

    Cheers!

    #1474435
    David

    Resolved.

    #1474489
    David
    Staff
    Customer Support

    Hi there,

    glad you found the answer 🙂

    #1646855
    Robert

    Hi David, (am trying to contact the original question setter)

    I am looking to do the same thing (adding Hreflang tags) to my own website. I wondered if you could explain how you did it?
    Did you need to create a new element for each page/post?

    I am doing it within one domain not two sites but think otherwise it is the same.

    I hope to hear from you.
    Regards,
    Rob

    #1647124
    David
    Staff
    Customer Support

    Hi there,

    no need for multiple Elements.
    For each Element you can set any number of Display Rules. Or use a single display rule that covers your needs.

    For example the Entire Site display location will cover the entire site. This would be Global scope.
    Or a wide scope Display Rule could be Posts > All Posts

    You can match Locations with Exclusions. For example: Location: Entire Site and Exclude: Page > A specific page.

    #1647212
    Robert

    Hi David,
    Thank you for your reply. I was expecting from the other David that first posted but Im sure you can still help, thank you.

    I am looking to use Hreflang tag which is for telling Google about alternative pages in different languages. I therefore have to reference specific pages (the alternative languages) within the element.

    I think I therefore need a new element for each page that is then located in the ‘head’ of each language version of that page, which I can do using the drop down options.
    I have done this and it seems to work.
    My question is:
    If I have lots of elements, (if I translate 100+ pages this would require 100+ Hook Element) will it slow down the whole website or just the slow the pages where the Element is applied?
    Do you know of a better method?
    Regard,
    Rob

    #1647493
    David
    Staff
    Customer Support

    Which translation plugin are you using ?

    #1647507
    Robert

    I’m not.
    I am just doing it using the hook element to avoid another plugin.
    Maybe not saving anything?

    Thanks

    #1647518
    David
    Staff
    Customer Support

    Hmmm…. it would be good if there was a way of identifying the language such as Taxonomy term. Are the foreign language posts in a separate category or ? If so then you can use the Post Category or Post Tags display rule.

    If there is no specific category/tag term – then you can register a custom taxonomy for your display rules – see this topic:

    https://generatepress.com/forums/topic/header-layout-control-for-client/#post-1421567

    #1731670
    TheSalvadorDaliOfWebsites

    I hope this is relevant to the thread: I am attempting to add <html lang=”da”> to improve hyphenation / line-breaking on a Danish language site I am working on.

    I created a hook like so:
    Elements > create new hook > <html lang=”da”>
    Settings: Hook > wp_head
    Display rules: Location > Entire Site

    Is this the proper way to get a tag to display inside the HTML tag?
    https://www.w3schools.com/tags/ref_language_codes.asp

    Thanks in advance.

    #1731673
    Leo
    Staff
    Customer Support
    #1731751
    TheSalvadorDaliOfWebsites

    Hi Leo,

    Good to hear. I am seeing it also in the source code of my page, so the hook is working.

    But: very first line of code in the page source is

    <html lang="en-US">

    Is there a function in GeneratePress to change this to, for example, Danish?

    #1731755
    TheSalvadorDaliOfWebsites

    The answer to my own question:
    Wordpress dashboard > Settings > General > Site Language

    #1731760
    TheSalvadorDaliOfWebsites

    And if you don’t want the WP Dashboard language to change along with the site language, you can set a custom language for each user under the user preferences in WP Dashboard.

Viewing 15 posts - 1 through 15 (of 16 total)
  • You must be logged in to reply to this topic.