• Resolved Anonymous User 17976131

    (@anonymized-17976131)


    Topic title says it: Jetpack is using “Front Page” as the Open Graph title for my blog’s front page instead of, like, my blog’s overall title/site name.

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

Viewing 16 replies (of 16 total)
  • Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic ??

    If you view the source on the front of bix.blog you can see it’s happening there.

    Ah, I understand what you mean now! This should match the front page’s title, currently set to “Front Page”. If you edit the page title here, the Twitter tag will update too.

    the og:title is set to the same as og:site_name instead of the page name, and og:description is set to the blog description not to an excerpt of the actual page. I assume that’s intended

    It is intended indeed, although I could see how useful it would be to change that.

    could I hook into the Jetpack OG function to use the page title and page excerpt there?

    Yes, you can definitely change that, using the same filter I pointed out earlier. Something like this should work:

    add_filter(
    	'jetpack_open_graph_tags',
    	function ( $tags ) {
    		// Special condition for the posts page.
    		if ( is_home() ) {
    			unset( $tags['og:title'] );
    			unset( $tags['og:description'] );
    			
    			// ID of our Posts page.
    			$posts_page_id = (int) get_option( 'page_for_posts' );
    			$tags['og:title'] = esc_html( get_the_title( $posts_page_id ) );
    			$tags['og:description'] = 'a custom description just for the posts page';
    		}
    		return $tags;
    	}
    );
Viewing 16 replies (of 16 total)
  • The topic ‘Open Graph tags using “Front Page” as title instead of my blog’s name’ is closed to new replies.