Giter Club home page Giter Club logo

Comments (2)

jerclarke avatar jerclarke commented on July 25, 2024

Alright, so in developing our own solution for this we concluded that the only sensible option would be to add two filters to the plugin itself, which we have submitted as PR #48

These are simple and harmless unless the filter is used, but allow enormous flexibility to developers implementing Amber.

They have separate filter names (amber_lookup_url and amber_enqueue_check_link) so that they can be handled separately if necessary, but should usually have the same filtering function/method attached, since for most cases, you'll want both places to do the same manipulations on the URLs.

In the Twitter case, we can use this filter to remove ?ref_url and any other URL query variables from the URL before it is checked (so the check has a chance to pass) as well as when the link is checked on display (so that it will match the database entry for that URL, which otherwise would be difference since the database would have the sans-ref_url version but the display checker would have the has-ref_url version).

This filter can also be used for all kinds of other things too! It could be used to do a very nuanced "blacklist" task that involved checking something more elaborate than Regex, it could be used to completely replace one domain with another etc.

Please, I beg of you, add this filter to the plugin.

If you like, you can also incorporate the Twitter filter, so that Twitter will work better for all your users. If not that's fine though, having access to the filter is much more important for us.

from amber_wordpress.

jerclarke avatar jerclarke commented on July 25, 2024

NOTE: looking at our error log, I'm seeing a lot of this, despite running the filter described above that avoids triggering twitter.com/robots.txt:

[28-Jun-2018 15:21:31 UTC] [...]/wp-content/plugins/amberlink/libraries/AmberChecker.php:AmberChecker::check:Blocked by robots.txt:https://t.co/wnn0C8bIVr 

Quick look at http://t.co/robots.txt explains it:

User-agent: twitterbot
Disallow:

User-agent: *
Disallow: /

So it seems any Twitter link in the t.co format will always die, which is a bummer.

Possibility to fix: Have a filter (like the one above) that does the full permalink expansion of t.co URLs before doing anything with them, so that the system only gets the working twitter.com version.

Haven't done it yet but documenting it here for myself and/or others.

from amber_wordpress.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.