SwiftLinkPreview icon indicating copy to clipboard operation
SwiftLinkPreview copied to clipboard

FIXED: Amazon links did not contain og tags with the default user agent

Open chadpav opened this issue 3 years ago • 1 comments

Action

ADDED: 'userAgent' with a default value to preserve current behavior ADDED: 'googleBotUserAgent' static which can be used to override the default ADDED: unit tests for Amazon links and tested across several other major ecommerce sites

NOTE: Not only does this fix OG tags for amazon.com links but the pages are way smaller due to Amazon optimizing for google search indexing (huge performance boost for preview response times)

  • Made user agent a configurable property to optimize for some websites (Amazon was the driver for this)
    • Issues: none
    • Commits: 546b86e12ca38617483c922d1d355fe0e785ff40

chadpav avatar Nov 13 '21 17:11 chadpav

@LeonardoCardoso I forked and made this change for my project. I'm getting better results with the google bot user agent across all sites but I left the default user agent in place so it doesn't change existing behavior.

I don't often contribute back so let me know if this was the right way to do it and I can update. Hope this helps.

chadpav avatar Nov 13 '21 17:11 chadpav