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

Pinterest conflicts #101

Closed
michaeltieso opened this issue Oct 2, 2020 · 13 comments
Closed

Pinterest conflicts #101

michaeltieso opened this issue Oct 2, 2020 · 13 comments
Labels
bug Something isn't working

Comments

@michaeltieso
Copy link

Describe the bug
Causes Pinterest to load thumbnails from Algolia instead of the blog post.

To Reproduce
Steps to reproduce the behavior:

  1. Enable plugin.
  2. Create pin on Pinterest.

Expected behavior
Should be loading images from the blog post.

Screenshots
Screen Shot 2020-10-02 at 10 45 09 AM

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]
@richaber
Copy link
Contributor

richaber commented Oct 2, 2020

Howdy @michaeltieso,

With the caveat that I can't provide Pinterest specific support...

I visited https://thetravellingmom.ca/skiing-in-western-canada/

I clicked the "Pinterest" icon and saved to a Pinterest "board".

Screen Shot 2020-10-02 at 12 23 14 PM
Screen Shot 2020-10-02 at 12 26 47 PM
Screen Shot 2020-10-02 at 12 26 55 PM
Screen Shot 2020-10-02 at 12 27 18 PM

I'm not really a Pinterest user, but it appears that worked as expected.

I'm afraid I need more details about the issue you are describing, if I am to determine whethre the issue originates within the WP Search with Algolia plugin itself.

Can you provide the exact steps to recreate the issue?

@richaber richaber added question Further information is requested can't reproduce We cannot reproduce the issue with a standard installation and default theme labels Oct 2, 2020
@richaber
Copy link
Contributor

richaber commented Oct 6, 2020

Interesting side note, Pinterest appeared to scrape the title used on the pin from Algolia instead of from the article itself. 🤔

@richaber
Copy link
Contributor

richaber commented Oct 6, 2020

Yet, when I visit that exact same pin today, the article headline is displayed on the pin...
Screen Shot 2020-10-06 at 8 30 15 AM

@richaber
Copy link
Contributor

richaber commented Oct 6, 2020

It appears in my testing that this issue presents when using autocomplete.

My current hypothesis is that Pinterest's "scraper" has difficulty parsing past the underscore.js style templates in the header.

I am going to open a PR that moves the autocomplete underscore.js style templates and the config into the footer, which I think will resolve the Pinterest issues that are being reported.

richaber added a commit that referenced this issue Oct 7, 2020
@richaber richaber added bug Something isn't working and removed can't reproduce We cannot reproduce the issue with a standard installation and default theme question Further information is requested labels Oct 7, 2020
@richaber
Copy link
Contributor

richaber commented Oct 7, 2020

To be clear, WP Search with Algolia does not inject any text or images into Pinterest pins.

Some users have reported the text "Hosted Site Search & Discovery for Companies of All Sizes" being used for the Pin title, however, the plugin does not contain that text.

When a "pin" is saved, Pinterest "scrapes" the URL, and parses the markup, Open Graph, and other meta tags that it finds, to determine what text and image to use for the pin.

WP Search with Algolia does not modify any Open Graph or other meta tags in the page.

My testing seems to indicate that this issue may be related specifically to the autocomplete implementation.

When autocomplete is enabled, the plugin adds some underscore.js style templating into the header of the page.

It appears that Pinterest has difficulty parsing past the autocomplete template in the head.

I believe that moving the JS, autocomplete underscore.js template, and config, to the footer of the page should alleviate issues that WP Search with Algolia / Pinterest users are reporting.

@richaber richaber changed the title Overriding Pinterest Thumbnails Pinterest conflicts Oct 7, 2020
@richaber
Copy link
Contributor

richaber commented Oct 7, 2020

I believe the fix/101-pinterest-incompatibility branch should resolve Pinterest issues for most users, however, I would like to perform a little more testing before release.

richaber added a commit that referenced this issue Oct 7, 2020
@richaber
Copy link
Contributor

richaber commented Oct 7, 2020

Testing from my own public facing blog with version 1.4.0:

Screen Shot 2020-10-06 at 7 47 46 PM

Testing from my own public facing blog with version 1.5.0-dev:

Screen Shot 2020-10-06 at 7 55 03 PM

@richaber
Copy link
Contributor

richaber commented Oct 7, 2020

Verified that autocomplete functions as expected in 1.5.0-dev.

Screen Shot 2020-10-06 at 8 12 25 PM

Verified that instantsearch functions as expected in 1.5.0-dev.

Screen Shot 2020-10-06 at 8 08 52 PM

@richaber
Copy link
Contributor

richaber commented Oct 7, 2020

Worth noting/mentioning that moving the scripts, autocomplete template, and config to the footer might make the algolia_load_scripts_in_footer hook unnecessary. It was introduced in 1.3.0 as a way for devs to load the Algolia JS libs in the footer for performance reasons. I've defaulted it to true in 1.5.0-dev as part of moving everything into the footer that the Pinterest scraper might choke on.

@richaber richaber pinned this issue Oct 7, 2020
richaber added a commit that referenced this issue Oct 7, 2020
@kakashigr
Copy link

Apparently if you remove this code from autocomplete.php, everything works correctly:

jQuery(document).on("click", ".algolia-powered-by-link", function (e) { e.preventDefault(); window.location = "https://www.algolia.com/?utm_source=WordPress&utm_medium=extension&utm_content=" + window.location.hostname + "&utm_campaign=poweredby"; });

@richaber
Copy link
Contributor

richaber commented Oct 7, 2020

Thank you for the additional information @kakashigr

I'm not sure why Pinterest's scraper follows the algolia-powered-by-link offsite and pulls data from the Algolia domain. That is clearly an issue with Pinterest that we can't control.

However, moving the autocomplete template output that contains that link to the footer, appears to resolve the issue in my testing.

Screen Shot 2020-10-07 at 8 36 02 AM

Screen Shot 2020-10-07 at 8 36 27 AM

Screen Shot 2020-10-07 at 8 36 45 AM

Screen Shot 2020-10-07 at 8 37 01 AM

Screen Shot 2020-10-07 at 8 37 47 AM

@richaber
Copy link
Contributor

richaber commented Oct 7, 2020

Pinterest issues should be resolved by WP Search with Algolia version 1.5.0.

@richaber richaber closed this as completed Oct 7, 2020
@richaber richaber unpinned this issue Oct 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants