Problem with Meta-Tags in directory

#141211
  • Resolved Jakob Winter
    Rank Math free

    Hello,

    i am using rankmath and web directory 2.0 free for wordpress.

    My Problem is that the meta-teags (og:title, og:image, text,…) which are used for different reasons, mainly sharing on social media are generated twice in my directory listings.
    The directory has a page with meta-tags.
    and on each directory listing meta-tags are generated for the page as well as the directory.

    Social media uses always the first set of tags and therefore when sharing a directory entry it always shows the content of the Page (directory start site)

    Therefore i wonder if i can deactivate the meta-tags for this single page or is there an option that rankmath knows that it is now an directory listing and does not generate the tags twice.

    Looking forward to your replies.

Viewing 15 replies - 1 through 15 (of 20 total)
  • Hello,

    Thank you for contacting Rank Math and bringing your concern to our attention. I’m sorry for any inconvenience this issue may have caused you.

    You can remove the open graph tags from Rank Math by customizing the filter in this link:
    https://rankmath.com/kb/filters-hooks-api-developer/#remove-opengraph-tags

    I hope that helps. Thank you, and looking forward to your update.

    Thank you very much for your quick and usefull reply.

    I am not sure how to apply this code only for one page. The directory main page.
    For all other pages the OG:tags are required and wanted.

    Furthermore, i try to avoid further manual coding as i have to re-apply changes after each update.

    Therefore would you recommend e.g using a code-snippest plug to add it only on the requested site?

    Hello,

    i do have a general questions about this issue. I cannot use the social media share buttons for directory listings because sharing would only show the main directory page instead of the listing. Therefore listings arent shareable right now.

    Rankmath recognized the directory plugin as new options for directory listings appeared.

    Now i wonder if this issue is only related to the directory i am using?

    Hello,

    The code needs to be added to your theme functions.php file. It is actually recommended to create a child theme to avoid having changes overwritten with updates. Feel free to use the code snippets plugin, it is also a considerable option.

    Would you mind sharing download link to the directory plugin you are using so we can test from our end? Also create a screencast with a tool such as https://www.loom.com on how to replicate the issue and share in the sensitive section.

    Looking forward to helping you

    Thank you very much for your reply.

    In my case i would only deactivate the og: meta tags for a single page. (the directory main page to avoid the double tags) in general i need the tags. i just want them to be unique in the listing so i can share them.

    this is the directory i am using.

    https://wordpress.org/plugins/web-directory-free/

    I added the tags in the sensitive data field, but i dont know if you can see it.

    https://hortione.com/where-to-buy-led-grow-boards/proweeda-gmbh/

    this site is an example. when showing at the source code you can see the tags are generated twice. It is the same behaviour for each listing.

    Roel John
    Rank Math business

    Hello,

    Thank you for contacting Rank Math.

    You can use the code below. The code below will only run on your single page.

    
    add_filter( "rank_math/opengraph/facebook/og_updated_time", function( $content ) {
    	if(is_single()){
    	   return false;
    	}
    return $content;
    });
    
    add_filter( "rank_math/opengraph/facebook/og_site_name", function( $content ) {
    	if(is_single()){
    	   return false;
    	}
    return $content;
    });
    
    add_filter( "rank_math/opengraph/facebook/og_type", function( $content ) {
    	if(is_single()){
    	   return false;
    	}
    return $content;
    });
    
    add_filter( "rank_math/opengraph/facebook/og_locale", function( $content ) {
    	if(is_single()){
    	   return false;
    	}
    return $content;
    });
    

    Please let us know if this helps you. So we can assist you further on this issue.

    Thank you.

    Dear Roel,

    thank you for your reply and effort.
    I think it could be the right direction for a solution.

    I think i need to use is_page instead of is_single as the documention sais is_single is not related to pages. The directory is embedded via shortcode in a page.

    I am not sure, if the code works, doesnt it affect the listings? because they are in the same page`?

    Independt from my first suggestion of a workaround by deactivating og:tags.

    The actual problem is the creation of dublicated tags. Can you think of an alternative solution why this happens?`

    I tried variantions of the code, but without success.
    Side node. i am not a developer. i do have basic scills but i am not a developer.

    add_filter( "rank_math/opengraph/facebook/og_updated_time", function( $content ) {
    	if(is_page( $page = 'where-to-buy-led-grow-boards')){
    	   return false;
    	}
    return $content;
    });
    
    add_filter( "rank_math/opengraph/facebook/og_site_name", function( $content ) {
    	if(is_page( $page = 'where-to-buy-led-grow-boards')){
    	   return false;
    	}
    return $content;
    });
    
    add_filter( "rank_math/opengraph/facebook/og_type", function( $content ) {
    	if(is_page( $page = 'where-to-buy-led-grow-boards')){
    	   return false;
    	}
    return $content;
    });
    
    add_filter( "rank_math/opengraph/facebook/og_locale", function( $content ) {
    	if(is_page( $page = 'where-to-buy-led-grow-boards')){
    	   return false;
    	}
    return $content;
    });

    Update: the code above worked partly.

    the og:type is removed only on the main page but not on the listing -> as I want it.

    Unfortunately i cannot extend it to the other tags: e.G og:title. or:image,,.

    Is there a way to deactivate all tags: with the use of the is_page filter?

    I tried also the following code without success:

    
    	if(is_page( $page = 'where-to-buy-led-grow-boards')){
    
    	add_action( 'rank_math/head', function() {
    	remove_all_actions( 'rank_math/opengraph/facebook' );
    	remove_all_actions( 'rank_math/opengraph/twitter' );
    });	
    		};
    

    Hello,

    Since you are using the slug in your condition, you will need to make sure to include the slug of the listing for example proweeda-gmbh. The slug in your code is currently for the main page and will only affect the main parent page.

    You can also check all pages whose parent page is that specific page for example, assuming the page(/where-to-buy-led-grow-boards/) id is 10, use if('10' == $post->post_parent).

    Hope this helps you.

    Thanks

    Hello,
    update:

    After trying different versions, i tried to deactivate the og:tags without any if restriction.

    just:
    add_action( ‘rank_math/head’, function() {
    remove_all_actions( ‘rank_math/opengraph/facebook’ );
    remove_all_actions( ‘rank_math/opengraph/twitter’ );

    The result was that the meta-tags where provided by WP/the Theme instead of rankmath.
    but the meta-tags at the directory listings where correctly provided by the theme.

    Right now i am not able to deactive the tags for the directory and its listings. And i do not want to deactivate them at all because it is actually a feature from rankmath i need and like.

    Maybe you find a general solution for this topic for the next update.

    a possible woraround could be deactivating the tags for the entire directory (didn work yet) then, the tags would be provided by WP/ Theme. But this would just be a worafound.

    Roel John
    Rank Math business

    Hello,

    Thank you for contacting Rank Math.

    The code above will not work because you using the $page variable to compare the URL. Please use the code below if that works for you.

    
    add_filter( "rank_math/opengraph/facebook/og_updated_time", function( $content ) {
    	if(is_page('where-to-buy-led-grow-boards')){
    	   return false;
    	}
    	return $content;
    });
    add_filter( "rank_math/opengraph/facebook/og_site_name", function( $content ) {
    	if(is_page('where-to-buy-led-grow-boards')){
    	   return false;
    	}
    	return $content;
    });
    add_filter( "rank_math/opengraph/facebook/og_type", function( $content ) {
    	if(is_page('where-to-buy-led-grow-boards')){
    	   return false;
    	}
    	return $content;
    });
    add_filter( "rank_math/opengraph/facebook/og_locale", function( $content ) {
    	if(is_page('where-to-buy-led-grow-boards')){
    	   return false;
    	}
    	return $content;
    });
    

    Please let us know if this helps you so we can assist you further on this issue.

    Thank you.

    Thank you for your reply.

    Using this code and adding some tags e.g og_image causes very strange issues.

    1. the directory listing is not showing the main page tags anymore BUT the tags are automatically generated (not by rankmath settings) and therefore just showing mixed and wrong results.

    2. on the directory mein page (‘where-to-buy-led-grow-boards’) the tags also generated by some random content.

    The 2. i could live with. But i somehow need rankmath to still create the tags for the listings. e.g custom text for social media or images,…

    Hello,

    Would you mind if we check this from your backend? If not, please edit the first post on this ticket and include your WordPress & FTP logins in the designated Sensitive Data section.
    Sensitive Data Section

    It is completely secure and only our support staff has access to that section. If you want, you can use the below plugin to generate a temporary login URL to your website and share that with us instead:

    https://wordpress.org/plugins/temporary-login-without-password/

    You can use the above plugin in conjunction with the WP Security Audit Log to monitor what changes our staff might make on your website (if any):

    https://wordpress.org/plugins/wp-security-audit-log/

    We really look forward to helping you.

    Hello,

    I have updated the sensitive data as requested. Can you please check further?

    Thank you.

    Thank you for you effort,

    please see updated temporary data.

    Hello,

    Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.

    If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.

    Thank you.

Viewing 15 replies - 1 through 15 (of 20 total)

The ticket ‘Problem with Meta-Tags in directory’ is closed to new replies.