• Resolved iparker

    (@iparker)


    Hello,

    I use Yoast SEO and in the setting I have “title of the page” in the seo title.

    This “title of the page” is not the multiple domain but the main domain from the generell wordpress settings.

    Is it possible to get the current domain in it instead (the value from the constant MULTPLE_DOMAIN_DOMAIN).

    Hope you understand what I mean.

    Best regards,

    Timo

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter iparker

    (@iparker)

    Hello,

    I found this page https://kb.yoast.com/kb/yoast-wordpress-seo-titles-metas-template-variables/#custom-variables and this example https://gist.github.com/amboutwe/550c10ede7d065d9264930f5480ca748#file-yoast_seo_title_custom-variable-php so I used following code for this:

    // define the custom replacement callback
    function get_multiple_domain_for_yoast() {
        return MULTPLE_DOMAIN_DOMAIN;
    }
    
    // define the action for register yoast_variable replacments
    function register_custom_yoast_variables() {
        wpseo_register_var_replacement( '%%multiple_domain%%', 'get_multiple_domain_for_yoast', 'advanced', 'Domain die aufgerufen wurde' );
    }
    // Add action
    add_action('wpseo_register_extra_replacements', 'register_custom_yoast_variables');

    Seems to work.

    Best regards,

    Timo

    Plugin Contributor Gustavo Straube

    (@gustavostraube)

    Hey Timo,

    I’ll try to add this as a core feature to the plugin in one of the next releases. Thanks for the code snippet, BTW.

    Plugin Contributor Gustavo Straube

    (@gustavostraube)

    Hi!

    We finally have %%multiple_domain%% as a Yoast advanced variable right out of the box. It’s available starting at 0.11.0.

    hi,
    i′ll tried that using on a wp multisite with a couple of domains mapped to a certain blog of the multisite to have the current (mapped) domainname in the title.
    i am using yoast 10.1.3 and tried to add the code from iparker to the functions.php and bp-custom.php, also added %%multiple_domain%% to the title definition but it did not work.

    am i missing anything?
    tnx, Eric

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Snippet variable / Domain-Name for Yoast SEO’ is closed to new replies.