Magento 2 Page Speed DocumentationPage Speed

« Back to Magento 2 Page Speed

Table of Contents
  1. Installation
  2. Configuration
  3. CLI Commands
    1. Fix Duplicate Product Images
Need Help?

info@fishpig.com

 
  • Installation

    You can install the module for Magento 2 using Composer or you can manually install it using FTP.

    • Run the following commands in your Magento 2 root directory to install the module using Composer.

      # Add the FishPig Composer repo
      composer config repositories.fishpig composer https://repo.fishpig.co.uk/
          
      # Install the module using Composer
      composer require fishpig/magento2-pagespeed:*
      
      # Enable the module in Magento 2
      php bin/magento module:enable FishPig_PageSpeed
      
      # Run the Magento upgrade system
      php bin/magento setup:upgrade
    • You can download the latest version of the module from the Downloads page.

      Extract the ZIP file and upload the files to your Magento site at the directory below:

      app/code/FishPig/PageSpeed

      When creating the folders, ensure you use the correct capitalisation.

      To complete the installation, run the following commands in a terminal.

      # Enable the module in Magento 2
      php bin/magento module:enable FishPig_PageSpeed
      
      # Run the Magento upgrade system
      php bin/magento setup:upgrade

    ↑ Back to Top

  • Configuration

    PageSpeed comes ready configured but if you want to make any changes, you can do so in the Magento Admin by selecting: Stores > Configuration > FishPig > Page Speed

    ↑ Back to Top

  • CLI Commands

    Fix Duplicate Product Images

    If you have ever ran a GT Metrix speed report then you have probably seen the Serve resources from a consistent URL error message. This happens if products share the same images because Magento 2 does not detect duplicate images and creates a new copy with a different name. This can lead to many copies of one image being served for different products.

    Fixing this is a large manual task so we created a handy CLI command that will do it for you.

    # Calculate number of duplicate images
    bin/magento fishpig:pagespeed:duplicate-product-images
    
    # List duplicate images
    bin/magento fishpig:pagespeed:duplicate-product-images --list
    
    # Clean duplicate images from the database
    bin/magento fishpig:pagespeed:duplicate-product-images --clean
    
    # Clean duplicate images from the database and delete from server
    bin/magento fishpig:pagespeed:duplicate-product-images --clean --delete

    ↑ Back to Top