Facebook: Page's image (og:image) not taken when shared url contains hash part
In my page, say, example.com - I have a facebook meta tag instructing facebook to display a specific image when this page is shared:
<meta property="og:image" content="http://example.com/myimg.png" />
It seems to work fine and display the image when sharing example.com in facebook. However, this page may also get many arguments in the form example.com#someval. When sharing any of these combinations, the image is not displayed.
I found I can use https://developers.facebook.com/tools/debug/ - manually enter any such combination, and then click 'Fetch new scrape information'. After doing so, the image is displayed when sharing that specific combination. This could be a workaround if I had only a few value combinations, but I have many... Isn't there a solution to instruct facebook to display the same image regardless of the "hash" part of the url?
If it works after you manually debug the URLs, then there is likely nothing wrong with your OG implementation, and it is just that Facebook didn’t have the image cached before.
See https://developers.facebook.com/docs/sharing/best-practices#precaching for ways to avoid that, so that images will be available on first share already.