Remove emojis from Open graph meta tags (title and description) but not url!

AI-generated summary

alonle reported that Facebook shares display emoji shortcodes (e.g., :smile:) as text instead of rendering the actual emoji in Open Graph meta tags. They proposed modifying the crawla ble_meta_data function in application_helper.rb to strip these codes from the title and description, while explicitly preserving the URL. codinghorror requested clarification, which elijah provided by showing examples where shortcodes like :white_check_mark: appear in the description instead of the Unicode character (✓). codinghorror then suggested using a reverse Emoji-to-Unicode replacer and asked neil to coordinate with sam, who had previously written a function for this purpose. neil confirmed the task was completed and shared a screenshot demonstrating the fix.

Since the share to Facebook does not show any emojis but only show text like “smile”
I think we need to remove it and replace it with an empty string

Unfortunately, I’m not a ruby guy, but I think we need to add code in this file In function crawlable_meta_data and use opts[property].gsub('/:\S*:/','')

maybe this can also help to replace the emojis code with Unicode??

Remember that we only need to change the title and description, but not the URL

Can you please help? :smile:

2 Likes

Sorry, I am not understanding what you wrote here. Can you share screenshots?

He means things like this:

Iframely URL Debugger - Open Graph, Twitter Cards, oEmbed

Description

Focus :white_check_mark: Improve usability and design of password reset page. :white_check_mark: “Get a room” reminder sent once per topic, to any user who replies to the same user in that topic 3 times in a row. :white_check_mark: Much more secure cookie and token rotation scheme and database storage, upgrading to 1.8 is critical for improved db / cookie security :white_check_mark: Improve usability and design of invite accept page. “Secure email mode” site setting ensures that no conten…

He doesn’t want :white_check_mark:, he wants blank or ✓

4 Likes

Oh right, we should pass that through the reverse Emoji-to-Unicode-Emoji replacer. @neil can you confer with @sam as he wrote a function to do that?

7 Likes

Done!

9 Likes