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

Allow opting-out of AMP-to-AMP links, ensure 'Exit Reader Mode' link is non-AMP #4146

Merged
merged 20 commits into from
Jan 24, 2020

Commits on Jan 21, 2020

  1. Allow opting-out of AMP-to-AMP links with rel=not-amphtml

    As Weston suggested,
    this forces links to non-AMP.
    kienstra committed Jan 21, 2020
    Configuration menu
    Copy the full SHA
    92d0f28 View commit details
    Browse the repository at this point in the history
  2. Ensure the 'Exit Reader Mode' link goes to non-AMP

    Even if add_filter( 'amp_to_amp_linking_enabled', '__return_true' );
    is present, this should still go to non-AMP.
    kienstra committed Jan 21, 2020
    Configuration menu
    Copy the full SHA
    3feb885 View commit details
    Browse the repository at this point in the history
  3. Add a filter to opt-out of AMP-to-AMP links

    When in Reader or Transitional mode,
    links to the same origin will usually be
    to AMP.
    But this filter enables passing URLs
    that will link to non-AMP, not AMP.
    kienstra committed Jan 21, 2020
    Configuration menu
    Copy the full SHA
    10f423a View commit details
    Browse the repository at this point in the history
  4. Simplify a conditional to use an elseif block

    The if block only ran if the previous
    block didn't, so an elseif block
    probably makes sense here.
    kienstra committed Jan 21, 2020
    Configuration menu
    Copy the full SHA
    9409786 View commit details
    Browse the repository at this point in the history
  5. Add some comments in unit test

    It's not very clear what these are testing
    without the comments.
    kienstra committed Jan 21, 2020
    Configuration menu
    Copy the full SHA
    404455d View commit details
    Browse the repository at this point in the history
  6. Remove needless variable, move into conditional

    There's no need to store this in a variable,
    
    So simply move the boolean to the conditional.
    kienstra committed Jan 21, 2020
    Configuration menu
    Copy the full SHA
    64ddd3e View commit details
    Browse the repository at this point in the history
  7. Rename filter amp_to_amp_excluded_links

    This is clearer that it's in the AMP plugin,
    as the beginning serves as a sort of prefix.
    kienstra committed Jan 21, 2020
    Configuration menu
    Copy the full SHA
    25b02fb View commit details
    Browse the repository at this point in the history
  8. Handle cases of multpile rel values, using Weston's snippets

    The rel attribute can have multiple space-separated values:
    https://developer.mozilla.org/en-US/docs/Web/HTML/Link_types
    kienstra committed Jan 21, 2020
    Configuration menu
    Copy the full SHA
    8a2e3da View commit details
    Browse the repository at this point in the history
  9. Update includes/sanitizers/class-amp-link-sanitizer.php

    Commit Weston's suggestion
    
    Co-Authored-By: Weston Ruter <[email protected]>
    kienstra and westonruter committed Jan 21, 2020
    Configuration menu
    Copy the full SHA
    640834f View commit details
    Browse the repository at this point in the history
  10. Address failed Travis build: PHPCS array_search() warning

    Pass a 3rd argument of true to
    array_search() so that Travis passes.
    kienstra committed Jan 21, 2020
    Configuration menu
    Copy the full SHA
    3b58df0 View commit details
    Browse the repository at this point in the history

Commits on Jan 22, 2020

  1. Update unit tests for new rel value

    Now that it's changed to noamphtml,
    update this in the unit tests also.
    kienstra committed Jan 22, 2020
    Configuration menu
    Copy the full SHA
    ffec7e5 View commit details
    Browse the repository at this point in the history

Commits on Jan 23, 2020

  1. Commit Weston's suggestion for the Reader mode template

    The rel value was changed to noamphtml,
    so it should be reflected here also.
    
    Co-Authored-By: Weston Ruter <[email protected]>
    kienstra and westonruter committed Jan 23, 2020
    Configuration menu
    Copy the full SHA
    ff931c3 View commit details
    Browse the repository at this point in the history
  2. Change DocBlock of 'amp_to_amp_excluded_links'

    Using Weston's suggestion
    in the pull request.
    kienstra committed Jan 23, 2020
    Configuration menu
    Copy the full SHA
    77118d7 View commit details
    Browse the repository at this point in the history
  3. Change filter name to 'amp_to_amp_excluded_urls'

    As Weston pointed out,
    this is filtering URLs.
    kienstra committed Jan 23, 2020
    Configuration menu
    Copy the full SHA
    d953a27 View commit details
    Browse the repository at this point in the history
  4. Rename parameter 'excluded_amp_links' to 'excluded_urls'

    These are not really links,
    they're URLs.
    kienstra committed Jan 23, 2020
    Configuration menu
    Copy the full SHA
    b6dda38 View commit details
    Browse the repository at this point in the history
  5. Handle case of something like #heading at end of URL

    As Weston mentioned,
    this shouldn't be used in comparison.
    kienstra committed Jan 23, 2020
    Configuration menu
    Copy the full SHA
    f85e8be View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    a6d1597 View commit details
    Browse the repository at this point in the history
  7. Add a since tag to the new filter amp_to_amp_excluded_urls

    As Weston mentioned,
    this didn't have one.
    kienstra committed Jan 23, 2020
    Configuration menu
    Copy the full SHA
    160eb87 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    4701234 View commit details
    Browse the repository at this point in the history
  9. Fix some phpcs errors, mainly => alignment

    Do npm run lint:php:fix
    to fix some of these.
    kienstra committed Jan 23, 2020
    Configuration menu
    Copy the full SHA
    101b38d View commit details
    Browse the repository at this point in the history