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

feat(game): update opengraph meta description #1654

Merged

Conversation

wescopeland
Copy link
Member

This PR updates the OG description tag on game pages to provide a little more context on the page and also slightly improve SEO on the page itself. Currently the descriptions are short enough that Google "guesses" to fill in the blanks, and unfortunately a portion of the content it fills in isn't very helpful.

Screenshot 2023-07-08 at 5 55 51 PM

Also, these links are commonly shared on Discord. For games with achievements, we can provide helpful context to the user before they click through.

Using the example above, let's pretend our target game is Super Mario Bros. for NES.

Before
"Game Info for Super Mario Bros. (NES)" ... google starts guessing here

After, game has achievements
"There are 78 achievements worth 800 (5,944) points. Super Mario Bros. for NES - explore and compete on this classic game at RetroAchievements."

After, game has no achievements
"No achievements have been created yet for Super Mario Bros.. Join RetroAchievements to request achievements for Super Mario Bros. and earn achievements on many other classic games."

After, game is an event
"Junior Developer Graduate: An event at RetroAchievements. Check out the page for more details on this unique challenge."

public/gameInfo.php Outdated Show resolved Hide resolved
@@ -253,7 +253,41 @@ class='break-words whitespace-normal leading-normal'
);
?>
<?php if ($isFullyFeaturedGame): ?>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if you want to tackle it as part of this PR, but the mature hub warning doesn't go through this path, and that's what I'd expect web crawlers to encounter:

<meta property="og:title" content="~Homebrew~ Larry and the Long Look for a Luscious Lover (NES)">
<meta property="og:description" content="~Homebrew~ Larry and the Long Look for a Luscious Lover (NES)">
<meta property="og:image" content="http://localhost/assets/images/favicon.webp">
<meta property="og:url" content="http://localhost/game/17703">
<meta property="og:type" content="website">

After warning:

<meta property="og:title" content="~Homebrew~ Larry and the Long Look for a Luscious Lover (NES)">
<meta property="og:description" content="There are 54 worth 275 (299) points. ~Homebrew~ Larry and the Long Look for a Luscious Lover for NES - explore and compete on this classic game at RetroAchievements.">
<meta property="og:image" content="http://media.retroachievements.org/Images/047004.png">
<meta property="og:url" content="http://localhost/game/17703">
<meta property="og:type" content="retroachievements:game">

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly, hubs aren't handled.

<meta property="og:title" content="[Series - Dragon Quest \| Dragon Warrior] (Hubs)">
<meta property="og:description" content="[Series - Dragon Quest \| Dragon Warrior] (Hubs)">
<meta property="og:image" content="http://localhost/assets/images/favicon.webp">
<meta property="og:url" content="http://localhost/game/6708">
<meta property="og:type" content="website">

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably worth handling these as a separate unit of work. Note: Because the title and description are the same, Google is falling back to using another tag we render into <head>:

<meta name="description" content="Adding achievements to your favourite retro games since 2012">

For the mature hub games, I think this is probably okay:
Screenshot 2023-07-11 at 5 04 22 PM


For hubs themselves, the same thing is happening, but we can probably do a lot to enhance this experience:
Screenshot 2023-07-11 at 5 47 37 PM

However, I must confess I don't want to add more "special" hub logic into gameInfo.php unless absolutely necessary.

@wescopeland wescopeland requested a review from Jamiras July 11, 2023 21:52
@Jamiras Jamiras merged commit 5fdd198 into RetroAchievements:master Jul 12, 2023
@wescopeland wescopeland deleted the game-page-opengraph-description branch July 12, 2023 22:37
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

Successfully merging this pull request may close these issues.

2 participants