Tag Archive for: Semrush site audit tips

How to fix: Issues with unminified JavaScript and CSS files

Issue: Unminified JavaScript and CSS files are larger than necessary, slowing down page load times, which can negatively impact user experience and SEO.

Fix: Minify your JavaScript and CSS files by removing extra spaces, comments, and lines. If using external files, ask the host to minify them if possible.

Recommendations:

  1. Use Minification Tools: Use online tools or build tools (e.g., UglifyJS for JavaScript, CSSNano for CSS) to automate the minification process.
  2. Check External Resources: For third-party files, reach out to the host to see if they have a minified version or can provide one.
  3. Monitor Performance: After minifying, check page load speed to confirm improvements in performance.
  4. Automate Minification for Updates: Set up minification as part of your development workflow so new code is always minified.

Tip: Minified files load faster, boosting SEO and improving user experience.

 

More articles relating to JavaScript issues:

How to fix: Pages use too many JavaScript and CSS files

Issue: Using more than 100 JavaScript and CSS files on a page slows it down because each file requires a separate HTTP request, leading to longer load times, poor user experience, and lower search rankings.

Fix: Remove unnecessary JavaScript and CSS files, and combine essential ones to reduce the number of HTTP requests.

How to Fix for Beginners

  1. Identify Excessive Files: Use browser developer tools or an SEO tool to check how many JavaScript and CSS files your pages load.
    • Example: Your page loads 120 files, but many are unused or redundant.
  2. Remove Unnecessary Files: Look for scripts or styles that aren’t critical to your page and delete them.
    • Example: Unused animation libraries or outdated CSS files.
  3. Combine Files: Merge multiple CSS files into one and multiple JavaScript files into one where possible.
    • Example: Combine styles1.css, styles2.css, and styles3.css into a single styles.css file.
  4. Minify Files: Compress your combined JavaScript and CSS files to reduce file size.
    • Example: Use tools like UglifyJS or CSSNano to remove unnecessary characters from the code.
  5. Implement Asynchronous Loading: Load JavaScript files asynchronously or defer their execution to prioritize visible content.
    • Example: Add the async or defer attribute to your <script> tags.
  6. Test Page Speed: After cleanup, use tools like Google PageSpeed Insights to check your page’s performance and ensure improvements.

Tip: Fewer, optimized JavaScript and CSS files enhance page load speed, user experience, and SEO rankings.

 

More articles relating to JavaScript issues:

How to fix: Pages have a JavaScript and CSS total size that is too large

Issue: If your JavaScript and CSS files are too large (over 2 MB total), it can slow down page load times, hurting user experience and potentially lowering search engine rankings.

Fix: Remove any unnecessary JavaScript and CSS files. For essential files, try compressing or minifying them to reduce their size.

Recommendations

  1. Minify Files: Use minification tools to remove unnecessary characters and whitespace from JavaScript and CSS files, reducing their size.
  2. Combine Files: Combine multiple CSS or JavaScript files into one to reduce the number of requests.
  3. Use Only Essential Code: Review all code files and eliminate any that aren’t critical to page functionality.
  4. Consider Async and Defer Attributes: Load JavaScript files asynchronously or defer loading until needed to improve load times.
  5. Use Compression: Enable gzip or Brotli compression on your server to reduce file sizes during transfer.

Tip: Smaller JavaScript and CSS files improve load speed, boosting SEO and user experience.

 

More articles relating to JavaScript issues:

How to fix: Issues with uncached JavaScript and CSS files

Issue: Uncached JavaScript and CSS files force browsers to download these resources every time a user visits your page, slowing down page load times and frustrating visitors.

Fix: Enable browser caching for JavaScript and CSS files to allow browsers to store and reuse these resources, speeding up load times.

How to Fix for Beginners

  1. Enable Caching on Your Server: Configure your server to specify caching in the response header for your JavaScript and CSS files.
    • Example: Add the following to your .htaccess file (for Apache servers):
      <IfModule mod_expires.c>
        ExpiresByType application/javascript "access plus 1 month"
        ExpiresByType text/css "access plus 1 month"
      </IfModule>
  2. Set an Appropriate Cache Duration: Assign a reasonable caching duration for your files, such as one month or longer, for static resources.
    • Example: Cache-Control: max-age=2592000 (30 days).
  3. Check Third-Party Resources: If the JavaScript and CSS files are hosted externally, contact the resource owner and request they enable caching.
    • Example: If a library like example.com/script.js is slow, ask the host to add caching headers.
  4. Test Page Performance: Use tools like Google PageSpeed Insights or GTmetrix to confirm caching is working and load times are reduced.
  5. Monitor Regularly: Ensure new files added to your site also have proper caching settings.

Tip: Browser caching improves load times, enhances user experience, and boosts your page’s SEO performance.

 

More articles relating to JavaScript issues:

How to fix: Issues with uncompressed JavaScript and CSS files

Issue: Uncompressed JavaScript and CSS files increase your page’s size and slow down load time, negatively affecting user experience and potentially lowering SEO rankings.

Fix: Enable compression on your server for JavaScript and CSS files. For external files, contact the host to request compression.

Recommendations

  1. Enable Gzip or Brotli Compression: Configure your server to use Gzip or Brotli to compress JavaScript and CSS files, reducing file size.
  2. Use Compression Testing Tools: Check your site with online tools to confirm that JavaScript and CSS files are compressed.
  3. Monitor External Resources: For external files, confirm they don’t impact load speed. If they do, request compression from the file host.
  4. Regularly Audit Compression Settings: Periodically review your site’s compression settings, especially after updates, to ensure optimal performance.

Tip: Compressed files load faster, improving both SEO and user experience.

 

More articles relating to JavaScript issues:

How to fix: Issues with blocked internal resources in robots.txt

Issue: Blocking internal resources like CSS, JavaScript, or images in your robots.txt file prevents search engines from fully rendering your webpages. This can negatively affect indexing and rankings.

Fix: Update your robots.txt file to allow access to essential resources.

How to Fix for Beginners

  1. Identify Blocked Resources: Use tools like Google Search Console’s URL Inspection tool to see which resources are blocked.
    • Example: If CSS or JavaScript files like /assets/styles.css or /scripts/main.js are blocked, they may appear in the report.
  2. Check Your robots.txt File: Locate the Disallow directives in your robots.txt file.
    • Example: Disallow: /assets/ blocks all files in the /assets/ folder, including critical CSS or JS.
  3. Allow Essential Resources: Remove or update the Disallow directive to ensure search engines can access key resources.
    • Example: Change:
      Disallow
      

      To:

      Allow: /assets/styles.css
      Allow: /scripts/main.js
      
  4. Test for Fixes: Use Google’s robots.txt Tester in Search Console to confirm that the updated file no longer blocks critical resources.
  5. Validate Page Rendering: After unblocking, check your site’s rendering using Google Search Console to ensure it displays properly.

Tip: Allowing access to essential resources ensures search engines can fully understand and index your pages, improving rankings.

 

More articles relating to Robots.txt file:

 

More articles relating to Blocked resources:

How to fix: Uncompressed pages

Issue: Uncompressed pages don’t use compression like Gzip or Brotli, making them larger and slower to load. This leads to poor user experience and can hurt search engine rankings.

Fix: Enable compression on your web server to reduce page size and speed up load times.

How to Fix for Beginners

  1. Enable Compression on Your Server:
    • For Apache Servers: Add the following to your .htaccess file:
      <IfModule mod_deflate.c>
        AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/javascript
      </IfModule>
      
    • For NGINX Servers: Add:
      gzip on;
      gzip_types text/html text/css application/javascript;
      gzip_min_length 1000;
      
  2. Use Gzip or Brotli: Choose Gzip (widely supported) or Brotli (modern, faster) for compression. Both reduce page size significantly.
  3. Test for Compression: Use tools like Google PageSpeed Insights or GTmetrix to check if your pages are compressed.
  4. Check All Pages: Ensure compression is applied to all types of content, including HTML, CSS, and JavaScript files.
  5. Monitor Performance: After enabling compression, track your site’s speed to ensure improvements.

Tip: Compressed pages load faster, improving both user experience and search engine rankings.

How to fix: Links on HTTPS pages leading to HTTP page

Issue: Links on HTTPS pages that point to HTTP pages can confuse search engines about which version to prioritize and may lead to mixed content issues, affecting SEO and security.

Fix: Replace all HTTP links with their HTTPS versions.

How to Fix for Beginners

  1. Identify HTTP Links: Use an SEO audit tool to find links pointing to HTTP pages on your HTTPS site.
    • Example: https://example.com links to http://example.com/page instead of https://example.com/page.
  2. Update Internal Links: Replace all internal HTTP links with HTTPS in your site’s content, menus, and navigation.
    • Example: Change <a href="http://example.com/page"> to <a href="https://example.com/page">.
  3. Update External Links: For third-party HTTP links, check if an HTTPS version is available and update the link.
    • Example: Replace http://externalsite.com/resource with https://externalsite.com/resource.
  4. Redirect HTTP to HTTPS: Ensure your server has a 301 redirect in place to automatically send HTTP requests to their HTTPS versions.
  5. Test for Mixed Content: Use browser developer tools or online tools to scan for any remaining HTTP links on HTTPS pages.

Tip: Consistent HTTPS links improve security, SEO, and user trust.

How to fix: HTTP URLs in sitemap.xml for HTTPS site

Issue: If your sitemap.xml contains HTTP URLs for a website that uses HTTPS, it can confuse search engines, leading to incomplete or inefficient crawling of your site.

Fix: Update your sitemap.xml to ensure all URLs use HTTPS.

How to Fix for Beginners

  1. Identify HTTP URLs: Open your sitemap.xml file and look for any URLs that start with http:// instead of https://.
    • Example: http://example.com/page should be updated to https://example.com/page.
  2. Replace with HTTPS: Manually or using a tool, replace all HTTP URLs with their HTTPS versions.
  3. Check Redirects: Ensure your HTTP pages already redirect to HTTPS. If not, set up 301 redirects.
  4. Test the Sitemap: After updating, use Google Search Console’s “Sitemaps” tool to check and validate the updated sitemap.
  5. Monitor for Issues: Run regular audits to ensure future updates don’t reintroduce HTTP URLs.

Tip: Using consistent HTTPS URLs improves site security, SEO, and ensures proper indexing by search engines.

 

More articles relating to Sitemaps:

How to fix: Homepage does not use HTTPS encryption

Issue: If your homepage doesn’t use HTTPS, it’s less secure and may rank lower in search results because Google prioritizes secure websites.

Fix: Switch your homepage (and entire website) to HTTPS by installing an SSL certificate.

How to Fix for Beginners

  1. Get an SSL Certificate: Purchase or obtain a free SSL certificate from providers like Let’s Encrypt or your hosting provider.
    • Example: Your hosting provider may offer a free SSL setup.
  2. Enable HTTPS: Install the SSL certificate on your server and configure it to redirect all HTTP requests to HTTPS.
    • Example: Redirect http://example.com to https://example.com.
  3. Update Internal Links: Replace all internal HTTP links with their HTTPS versions.
    • Example: Update <a href="http://example.com/page"> to <a href="https://example.com/page">.
  4. Update External Links: Notify external sites linking to your homepage to use the HTTPS version.
  5. Check for Mixed Content: Use browser developer tools to ensure all resources (images, scripts, etc.) are loaded securely via HTTPS.
  6. Submit Updated Site to Search Engines: Update your sitemap in Google Search Console to reflect the HTTPS change.

Tip: HTTPS encryption improves security, user trust, and search engine rankings.