Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenGraph description tags aren't output on pages or attachments #1602

Closed
benlk opened this issue Dec 17, 2018 · 2 comments
Closed

OpenGraph description tags aren't output on pages or attachments #1602

benlk opened this issue Dec 17, 2018 · 2 comments
Milestone

Comments

@benlk
Copy link
Collaborator

benlk commented Dec 17, 2018

In the function largo_opengraph(), the open graph tag output for pages doesn't match that for single posts:

https://github.com/INN/largo/blob/d167efce9c2cb3f4a2a15a0d95705a24bca8470b/inc/open-graph.php#L33-L51

Because is_single() on a post of type 'page' is false, the open graph tags that are output are instead the fallback ones:

https://github.com/INN/largo/blob/d167efce9c2cb3f4a2a15a0d95705a24bca8470b/inc/open-graph.php#L59-L82

<meta property="og:title" content="<?php bloginfo( 'name' ); wp_title(); ?>" />
<meta property="og:type" content="article" />
<meta property="og:url" content="<?php echo esc_url( largo_get_current_url() ); ?>"/>
<?php
// ....
} else {
	$description = get_bloginfo( 'description' );
}
if ( $description ) {
	echo '<meta property="og:description" content="' . strip_tags( esc_html( $description ) ) . '" />';
	echo '<meta name="description" content="' . strip_tags( esc_html( $description ) ) . '" />';
}
@benlk benlk added this to the 0.6.2 milestone Dec 17, 2018
@benlk
Copy link
Collaborator Author

benlk commented Dec 17, 2018

Fix: change it to is_singular().

@benlk
Copy link
Collaborator Author

benlk commented Dec 17, 2018

Note the peculiar og:title property in the page's case:

<meta property="og:title" content="<?php bloginfo( 'name' ); wp_title(); ?>" />

On an interior page like inn.org/?s=, the og:title that is output has the site name twice.

<meta property="og:title" content="Institute for Nonprofit News &raquo; Search Results  &raquo;   &raquo; Institute for Nonprofit News" />
  • remove wp_title(); from there

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant