• Resolved seriiserii825

    (@seriiserii825)


    Hi.
    I create the post_type artisti, and also create the page Artisti.
    On this page i add the posts from post_type artisti with wp_query.
    Also i want to add meta.
    In admin, in math rank menu at Titles & Meta, i choose the Artisti archive, and i add the title and description. And i saw this data at the site page.

    But, i don’t know, how to add the the ogg meta for facebook and for twitter.

    Hope for your help.

    The page I need help with: [log in to see the link]

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Rank Math

    (@rankmath)

    Hello @seriiserii825

    Thank you for your message.

    The archive pages do not have a separate page. You can add this in the Titles & Meta >> Archive Page Settings:
    https://i.rankmath.com/Hn8ell

    Hope that helps.

    Thread Starter seriiserii825

    (@seriiserii825)

    Thank you for answer. But, i asked about ogg:description.
    In video you don’t show, how you addded description for facebook, or twitter, just the title.
    I wrote the title and description https://i.imgur.com/GTDwUzh.png
    And i see them on the page.

    flameshot_screenshot

    But how to add ogg description.
    The title is from the title archive, but the description?

    flameshot_screenshot

    flameshot_screenshot

    I wish, you will help me))

    • This reply was modified 4 years, 6 months ago by seriiserii825.
    Thread Starter seriiserii825

    (@seriiserii825)

    I resolved my problem so:

    	let addMeta = function () {
    		let pageTitle = location.pathname;
    
    		pageTitle = pageTitle.replace(/\//gi, '');
    
    		if ($('body').hasClass('post-type-archive-'+pageTitle+'')) {
    			let metaDescription = $('meta[name="description"]').attr('content');
    			let metaFacebook = '<meta property="og:description" content="' + metaDescription + '">';
    			let metaTwitter = '<meta property="twitter:description" content="' + metaDescription + '">';
    
    			$('head').append(metaFacebook);
    			$('head').append(metaTwitter);
    		}
    	};
    	addMeta();
    
    Plugin Author Rank Math

    (@rankmath)

    Hello @seriiserii825

    Ah. Sorry for the confusion.

    The Rank Math is not showing og:description on archive pages. It should show the description added in the Settings, We have created an issue internally.

    For now, please add the following code in your theme’s functions.php file:

    add_filter( 'rank_math/opengraph/facebook/og_description', 'rank_math_fallback_description' );
    add_filter( 'rank_math/opengraph/twitter/twitter_description', 'rank_math_fallback_description' );
    function rank_math_fallback_description( $content ) {
    	if ( ! is_post_type_archive() ) {
    		return $content;
    	}
    	return $content ? $content : RankMath\Paper\Paper::get()->get_description();
    }

    Hope that helps. Thank you.

    Thread Starter seriiserii825

    (@seriiserii825)

    Thanks

    Plugin Author Rank Math

    (@rankmath)

    Hello @seriiserii825

    We released a quick Beta update to fix the issue.

    Please enable the Beta update by following this:
    https://rankmath.com/kb/version-control/#beta-updates
    https://rankmath.com/wp-content/uploads/2020/02/Rank-Math-Beta-Testing.jpg

    If you are unable to see an update, please clear Rank Math’s transients from:
    WP Dashboard > Rank Math > Status & Tools > Database Tools > Remove Rank Math Transients > Remove transients
    https://i.rankmath.com/Pbu5J6

    Please clear the caches, server, and WordPress after updating.

    If the issue is still not resolved, please let us know.

    We are here to assist. Thank you.

    Thread Starter seriiserii825

    (@seriiserii825)

    Hi, thanks for help, but for me is not working.
    I activate the beta option

    flameshot_screenshot

    After, i clear the cache and in the admin at the archive menu i don’t saw the any change.

    rank math

    I need the fields for write a text for facebook and twitter for all languages.
    I use the plugin wpglobus.

    Now i just use the code in js to add meta

    	let addMeta = function () {
    		let pageTitle = location.pathname;
    
    		pageTitle = pageTitle.replace(/\//gi, '');
    
    		if ($('body').hasClass('post-type-archive-'+pageTitle+'')) {
    			let metaDescription = $('meta[name="description"]').attr('content');
    			let metaFacebook = '<meta property="og:description" content="' + metaDescription + '">';
    			let metaTwitter = '<meta property="twitter:description" content="' + metaDescription + '">';
    
    			$('head').append(metaFacebook);
    			$('head').append(metaTwitter);
    		}
    	};
    
    	addMeta();
    
    Plugin Author Rank Math

    (@rankmath)

    Hello @seriiserii825

    You have only enabled the Beta option but did not update it (as it seems from the screenshot you shared).

    Please update the plugin from the plugins page and also any other pending updates from other plugins you might have.

    Hope that helps. Thank you.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘How to add ogg meta for archive page?’ is closed to new replies.