SEO & JavaScript: 6 Things You Need to Know

Started by richardmsmith, 08-10-2018, 04:20:58

Previous topic - Next topic

richardmsmithTopic starter

JavaScript is a programming language used to make webpages dynamic and interactive. You can place JavaScript into an HTML document, or make a link or reference to it.
HTML stands for Hypertext Markup Language. In simple words, it is a content organizer: HTML provides a website's structure (bullet lists, headlines, subheadlines, paragraphs, etc.) and defines static content.
AJAX is Asynchronous JavaScript and XML. Basically, it updates content without refreshing the whole page. AJAX enables web applications and servers to communicate without intruding on the current page.
1. Let Search Engines See Your JavaScript
2. Internal Linking
3. URL Structure
4. Test Your Website
5. HTML Snapshots
6. Site Latency


supergolfer

#1
SEO & JavaScript: 6 Things You Need to Know

1. Let Search Engines See Your JavaScript
Robots.txt is set to provide Google search engines with appropriate crawling opportunities. If you block them from seeing JavaScript, the page will appear differently to web crawlers than it does to users.

This means that search engines won't get the full user experience, and Google may interpret such actions as cloaking.

The best approach is to provide web crawlers with all the resources they need to see webpages in the exact same manner as users.

Consider arranging a meeting with developers, and decide together which files should be hidden from search engines, and which of them should be made accessible.

2. Internal Linking
Internal linking is a strong SEO tool used to show search engines your website architecture and point to the most important webpages.

The most essential advice here: use internal linking, and do not even try to replace it with JavaScript on-click events.

Yes, end URLs are likely to be found and crawled with on-click events, but web crawlers won't associate them with the global navigation of your site.

Therefore, you would be better off to implement internal linking by using regular anchor tags within the HTML or DOM, to provide users with a better experience.

3. URL Structure
JavaScript-based websites used to include fragment identifiers within URLs, but lone hashes (#) and hashbangs (#!) are not recommended by Google.

A highly recommended method is pushState History API. It updates the URL in the address bar and allows JavaScript websites to leverage clean URLs.

A clean URL is also called a search engine-friendly URL, which consists of a plain text, easily understood by non-expert users.

Consider using pushState for infinite scroll, so the URL updates each time the user hits a new part of the page. In a perfect scenario, the user can refresh the page and still remain at the exact same spot.

Also, explore SEO best URL practices and start using them to improve user experience.

4. Test Your Website
Google is able to crawl and understand many forms of JavaScript, although some of them may be more challenging than others.

Here is an experiment by Bartosz Góralewicz that shows how Googlebot interacts with JavaScript on different frameworks.

This study helps us to understand when it is time to worry and act proactively.

However, it's always better to predict possible mistakes and problems and avoid them, so why not conduct some testing?

Follow these two basic steps to detect possible breaks:

Check whether the content on your webpages appears in the DOM.
Test a couple of pages to make sure that Google is able to index your content.
It is crucial to find out whether Google is able to see your content and JavaScript in your robots.txt and analyze it properly. Therefore, consider manually checking pieces of your content and fetching them with Google to see if content appears.

Test your website by following this short guide from Google.
5. HTML Snapshots
Google introduced HTML snapshots in 2009 and disapproved them in 2015. That is a long story and an ongoing topic.

The thing you should know is that Google stills support HTML snapshots, although it has determined them to be elements to "avoid."

HTML snapshots may be necessary for a couple of situations, so you should at least be familiar with them.

For example, if search engines cannot grasp the JavaScript on your website, you can provide them with an HTML snapshot, which is better than not having your content indexed and understood at all.

In a perfect world, a website would use some kind of user-agent detection on the server side and show the HTML snapshot to bots and users.

Note that Google strives to see the exact same experience as a viewer. Therefore, it is better to return HTML snapshots to search engine crawlers.

However, only do so in cases where there is currently something wrong with JavaScript, and it isn't possible to contact your support team.

6. Site Latency
When a browser creates DOM using a received HTML document, it loads the majority of resources exactly as they are mentioned in the HTML document.

If a massive file exists at the top of an HTML document, a browser will load this huge file first, and all other information will appear only afterward, with a significant delay.

The key idea of Google's critical rendering path is to first load pieces of information that are crucial for users. In other words, to place the most essential content for users above-the-fold.

If your JavaScript files or some unnecessary resources clog up the page load speed, you probably have a render-blocking JavaScript, also called a perceived latency.

This means that your pages have the potential to appear faster, but JavaScript code is slowing them down.

Check how long it takes to load a page with Page Speed Insights or other similar tools. Analyze the results to see if there is a render-blocking JavaScript.

Here are a couple of top solutions to resolve it:

Add JavaScript in the HTML.
Add the 'async' attribute to HTML to make your JavaScript asynchronous.
Reduce JavaScript elements within the HTML document.
When trying to improve the situation, keep in mind the basic rules of JavaScript.

For instance, scripts must be arranged in a certain order (order of precedence). If some scripts reference files, they can be used only after the referenced files are loaded.

You should constantly stay in touch with your development team to make sure that any alterations do not interrupt user experience.


When it comes to JavaScript and SEO, there are a few considerations to keep in mind:

1. Let Search Engines See Your JavaScript: Ensure that search engines can crawl and index your JavaScript content. Traditional web crawlers may struggle to execute JavaScript, so it's important to ensure that critical content is also available in HTML format.

2. Internal Linking: Establishing a proper internal linking structure helps search engines discover and navigate through your website. Use anchor tags and links to connect relevant pages within your website.

3. URL Structure: Create descriptive and search engine-friendly URLs for each page of your website. Avoid complex, dynamically generated URLs and use keywords that accurately represent the content of the page.

4. Test Your Website: Regularly test your website using tools like Google's Search Console to identify any crawl or rendering issues. This will help you address any potential SEO-related problems associated with JavaScript.

5. HTML Snapshots: Consider generating HTML snapshots of your JavaScript-driven content. HTML snapshots are static versions of your pages that can be crawled and indexed by search engines. This can be accomplished using prerendering techniques or specialized services.

6. Site Latency: Optimize your JavaScript code to minimize site latency. Page speed is an important ranking factor, and fast-loading websites generally provide a better user experience. Minify and compress your JavaScript files, leverage caching, and optimize images to reduce latency.

7. Responsive Design: Ensure that your website is designed and developed to be responsive and mobile-friendly. Search engines prioritize mobile-friendly websites in their rankings, so optimizing your site for different devices can positively impact SEO.

8. Accessibility: Make sure that your JavaScript-driven elements are accessible to all users, including those with disabilities. Use proper semantic markup, alternative text for images, and provide keyboard accessibility for interactive components.

9. Performance Optimization: Optimize the performance of your JavaScript code to improve page load times. This includes techniques like code minification, caching, lazy loading, and reducing unnecessary network requests.

10. Cross-browser Compatibility: Test your JavaScript functionality across different web browsers to ensure consistent performance and usability. Consider using browser compatibility tools and frameworks to handle any inconsistencies.

11. Progressive Enhancement: Employ progressive enhancement techniques by ensuring your website's core content and functionality are accessible without relying heavily on JavaScript. This approach ensures that users with JavaScript-disabled browsers or slow connections can still access your content.

12. Error Handling and Debugging: Properly handle JavaScript errors and exceptions to prevent negative impacts on user experience and search engine crawling. Regularly check your error logs and use debugging tools to identify and fix issues.

13. Security Measures: Implement security best practices to protect your JavaScript code and user data. Use secure coding practices, validate input, and protect against common web vulnerabilities like cross-site scripting (XSS) attacks.

14. Code Organization and Maintainability: Keep your JavaScript code well-organized and maintainable. Use modular code structures, follow naming conventions, and document your codebase. Well-structured code helps with understanding, maintenance, and future updates.

15. Version Control and Deployment Strategies: Use version control systems like Git to manage your JavaScript codebase. This allows for easier collaboration, rollbacks, and tracking changes over time. Deploy your JavaScript code in a controlled and efficient manner to minimize downtime and maintain website availability.

16. Content Rendering: Ensure that important content rendered by JavaScript is accessible to search engines. Search engines have become more capable of rendering JavaScript, but it's still important to test and ensure that your content is visible to them.

17. Structured Data Markup: Implement structured data markup using JSON-LD or other formats to provide search engines with additional context about your website's content. This can improve search engine understanding and potentially lead to rich snippets in search results.

18. Site Navigation: Design your website's navigation in a way that allows search engines to easily crawl and understand the site structure. Avoid complex JavaScript-based navigation that may hinder search engine accessibility.

19. URL Fragments (Hashbangs): Avoid using URL fragments (hashbangs) to display different content or states within a web page. Search engines may interpret these as separate URLs and cause indexing issues.

20. XML Sitemaps: Include your JavaScript-generated URLs in your XML sitemap to ensure search engines can discover and index them. Regularly update and submit your sitemap to search engines.

21. Social Metadata: Use JavaScript to dynamically generate social metadata, such as Open Graph tags and Twitter Card information, to enhance how your website is displayed on social media platforms, which can indirectly impact SEO.

22. Mobile-First Indexing: With Google's shift towards mobile-first indexing, ensure that your JavaScript content is optimized for mobile devices. Test and optimize for mobile page speed, usability, and responsiveness.

23. User Experience (UX): Prioritize user experience in your JavaScript implementation. Search engines take into account factors like bounce rates and time-on-site, so providing a smooth and engaging user experience can indirectly impact SEO performance.

24. Backlinks and Link Building: JavaScript-driven websites may face challenges when it comes to link building, as some external websites may not effectively parse or link to JavaScript-generated content. Consider strategies like outreach campaigns and content marketing to build high-quality backlinks.

25. Monitoring and Analytics: Regularly monitor your website's performance and SEO metrics using tools like Google Analytics. Analyze user behavior, conversion rates, and other key data to make informed decisions and optimize your JavaScript implementation.

26. Canonical URLs: Implement canonical URLs to avoid duplicate content issues when using JavaScript to dynamically generate URLs. This helps search engines understand which version of the page is the preferred one.

27. Meta Tags: Use JavaScript to dynamically generate meta tags, such as meta titles and descriptions, for each page. These tags play an important role in search engine rankings and can influence click-through rates from search results.

28. Content Loading: Utilize lazy loading techniques to improve page load speed, especially for images or other heavy media. This ensures that search engines can still crawl and index your content without significant delays.

29. Dynamic XML Sitemaps: If your website generates content dynamically through JavaScript, consider implementing dynamic XML sitemaps that reflect these changes. This allows search engines to discover and index new or updated pages efficiently.

30. Structured URLs: While URL structure may not directly impact search engine rankings, having descriptive and user-friendly URLs can lead to higher click-through rates from search results. Use JavaScript to create clean and meaningful URLs.

31. Internationalization (hreflang): If your website has international versions targeting different languages or regions, use JavaScript to implement hreflang tags. These tags help search engines understand which version of your content is relevant to specific geographic locations.

32. Handling AJAX Crawling: If you heavily rely on AJAX-based navigation or content loading, ensure that your website handles AJAX crawling properly. Use techniques like hashbang URLs or pushState to enable search engines to access and understand your AJAX-driven content.

33. Make Use of SEO Plugins and Libraries: Consider leveraging existing SEO plugins or libraries for popular JavaScript frameworks like React or Angular. These tools can help address common SEO challenges associated with these frameworks.

34. Monitor JavaScript Framework Updates: If your website uses a JavaScript framework or library, stay updated with their releases and ensure that you're using the latest versions. Framework updates often address performance, security, and SEO-related issues.

35. Structured Data Testing: Use Google's Structured Data Testing Tool or other similar tools to validate and test the structured data markup implemented on your website. This ensures that search engines can understand and interpret your structured data correctly.


jasonmiller

Quote from: supergolfer on 04-13-2019, 00:05:06
SEO & JavaScript: 6 Things You Need to Know

1. Let Search Engines See Your JavaScript
Robots.txt is set to provide Google search engines with appropriate crawling opportunities. If you block them from seeing JavaScript, the page will appear differently to web crawlers than it does to users.

This means that search engines won't get the full user experience, and Google may interpret such actions as cloaking.

The best approach is to provide web crawlers with all the resources they need to see webpages in the exact same manner as users.

Consider arranging a meeting with developers, and decide together which files should be hidden from search engines, and which of them should be made accessible.

2. Internal Linking
Internal linking is a strong SEO tool used to show search engines your website architecture and point to the most important webpages.

The most essential advice here: use internal linking, and do not even try to replace it with JavaScript on-click events.

Yes, end URLs are likely to be found and crawled with on-click events, but web crawlers won't associate them with the global navigation of your site.

Therefore, you would be better off to implement internal linking by using regular anchor tags within the HTML or DOM, to provide users with a better experience.

3. URL Structure
JavaScript-based websites used to include fragment identifiers within URLs, but lone hashes (#) and hashbangs (#!) are not recommended by Google.

A highly recommended method is pushState History API. It updates the URL in the address bar and allows JavaScript websites to leverage clean URLs.

A clean URL is also called a search engine-friendly URL, which consists of a plain text, easily understood by non-expert users.

Consider using pushState for infinite scroll, so the URL updates each time the user hits a new part of the page. In a perfect scenario, the user can refresh the page and still remain at the exact same spot.

Also, explore SEO best URL practices and start using them to improve user experience.

4. Test Your Website
Google is able to crawl and understand many forms of JavaScript, although some of them may be more challenging than others.

Here is an experiment by Bartosz Góralewicz that shows how Googlebot interacts with JavaScript on different frameworks.

This study helps us to understand when it is time to worry and act proactively.

However, it's always better to predict possible mistakes and problems and avoid them, so why not conduct some testing?

Follow these two basic steps to detect possible breaks:

Check whether the content on your webpages appears in the DOM.
Test a couple of pages to make sure that Google is able to index your content.
It is crucial to find out whether Google is able to see your content and JavaScript in your robots.txt and analyze it properly. Therefore, consider manually checking pieces of your content and fetching them with Google to see if content appears.

Test your website by following this short guide from Google.
5. HTML Snapshots
Google introduced HTML snapshots in 2009 and disapproved them in 2015. That is a long story and an ongoing topic.

The thing you should know is that Google stills support HTML snapshots, although it has determined them to be elements to "avoid."

HTML snapshots may be necessary for a couple of situations, so you should at least be familiar with them.

For example, if search engines cannot grasp the JavaScript on your website, you can provide them with an HTML snapshot, which is better than not having your content indexed and understood at all.

In a perfect world, a website would use some kind of user-agent detection on the server side and show the HTML snapshot to bots and users.

Note that Google strives to see the exact same experience as a viewer. Therefore, it is better to return HTML snapshots to search engine crawlers.

However, only do so in cases where there is currently something wrong with JavaScript, and it isn't possible to contact your support team.

6. Site Latency
When a browser creates DOM using a received HTML document, it loads the majority of resources exactly as they are mentioned in the HTML document.

If a massive file exists at the top of an HTML document, a browser will load this huge file first, and all other information will appear only afterward, with a significant delay.

The key idea of Google's critical rendering path is to first load pieces of information that are crucial for users. In other words, to place the most essential content for users above-the-fold.

If your JavaScript files or some unnecessary resources clog up the page load speed, you probably have a render-blocking JavaScript, also called a perceived latency.

This means that your pages have the potential to appear faster, but JavaScript code is slowing them down.

Check how long it takes to load a page with Page Speed Insights or other similar tools. Analyze the results to see if there is a render-blocking JavaScript.

Here are a couple of top solutions to resolve it:

Add JavaScript in the HTML.
Add the 'async' attribute to HTML to make your JavaScript asynchronous.
Reduce JavaScript elements within the HTML document.
When trying to improve the situation, keep in mind the basic rules of JavaScript.

For instance, scripts must be arranged in a certain order (order of precedence). If some scripts reference files, they can be used only after the referenced files are loaded.

You should constantly stay in touch with your development team to make sure that any alterations do not interrupt user experience.


When it comes to JavaScript and SEO, there are a few considerations to keep in mind:

1. Let Search Engines See Your JavaScript: Ensure that search engines can crawl and index your JavaScript content. Traditional web crawlers may struggle to execute JavaScript, so it's important to ensure that critical content is also available in HTML format.

2. Internal Linking: Establishing a proper internal linking structure helps search engines discover and navigate through your website. Use anchor tags and links to connect relevant pages within your website.

3. URL Structure: Create descriptive and search engine-friendly URLs for each page of your website. Avoid complex, dynamically generated URLs and use keywords that accurately represent the content of the page.

4. Test Your Website: Regularly test your website using tools like Google's Search Console to identify any crawl or rendering issues. This will help you address any potential SEO-related problems associated with JavaScript.

5. HTML Snapshots: Consider generating HTML snapshots of your JavaScript-driven content. HTML snapshots are static versions of your pages that can be crawled and indexed by search engines. This can be accomplished using prerendering techniques or specialized services.

6. Site Latency: Optimize your JavaScript code to minimize site latency. Page speed is an important ranking factor, and fast-loading websites generally provide a better user experience. Minify and compress your JavaScript files, leverage caching, and optimize images to reduce latency.

7. Responsive Design: Ensure that your website is designed and developed to be responsive and mobile-friendly. Search engines prioritize mobile-friendly websites in their rankings, so optimizing your site for different devices can positively impact SEO.

8. Accessibility: Make sure that your JavaScript-driven elements are accessible to all users, including those with disabilities. Use proper semantic markup, alternative text for images, and provide keyboard accessibility for interactive components.

9. Performance Optimization: Optimize the performance of your JavaScript code to improve page load times. This includes techniques like code minification, caching, lazy loading, and reducing unnecessary network requests.

10. Cross-browser Compatibility: Test your JavaScript functionality across different web browsers to ensure consistent performance and usability. Consider using browser compatibility tools and frameworks to handle any inconsistencies.

11. Progressive Enhancement: Employ progressive enhancement techniques by ensuring your website's core content and functionality are accessible without relying heavily on JavaScript. This approach ensures that users with JavaScript-disabled browsers or slow connections can still access your content.

12. Error Handling and Debugging: Properly handle JavaScript errors and exceptions to prevent negative impacts on user experience and search engine crawling. Regularly check your error logs and use debugging tools to identify and fix issues.

13. Security Measures: Implement security best practices to protect your JavaScript code and user data. Use secure coding practices, validate input, and protect against common web vulnerabilities like cross-site scripting (XSS) attacks.

14. Code Organization and Maintainability: Keep your JavaScript code well-organized and maintainable. Use modular code structures, follow naming conventions, and document your codebase. Well-structured code helps with understanding, maintenance, and future updates.

15. Version Control and Deployment Strategies: Use version control systems like Git to manage your JavaScript codebase. This allows for easier collaboration, rollbacks, and tracking changes over time. Deploy your JavaScript code in a controlled and efficient manner to minimize downtime and maintain website availability.

16. Content Rendering: Ensure that important content rendered by JavaScript is accessible to search engines. Search engines have become more capable of rendering JavaScript, but it's still important to test and ensure that your content is visible to them.

17. Structured Data Markup: Implement structured data markup using JSON-LD or other formats to provide search engines with additional context about your website's content. This can improve search engine understanding and potentially lead to rich snippets in search results.

18. Site Navigation: Design your website's navigation in a way that allows search engines to easily crawl and understand the site structure. Avoid complex JavaScript-based navigation that may hinder search engine accessibility.

19. URL Fragments (Hashbangs): Avoid using URL fragments (hashbangs) to display different content or states within a web page. Search engines may interpret these as separate URLs and cause indexing issues.

20. XML Sitemaps: Include your JavaScript-generated URLs in your XML sitemap to ensure search engines can discover and index them. Regularly update and submit your sitemap to search engines.

21. Social Metadata: Use JavaScript to dynamically generate social metadata, such as Open Graph tags and Twitter Card information, to enhance how your website is displayed on social media platforms, which can indirectly impact SEO.

22. Mobile-First Indexing: With Google's shift towards mobile-first indexing, ensure that your JavaScript content is optimized for mobile devices. Test and optimize for mobile page speed, usability, and responsiveness.

23. User Experience (UX): Prioritize user experience in your JavaScript implementation. Search engines take into account factors like bounce rates and time-on-site, so providing a smooth and engaging user experience can indirectly impact SEO performance.

24. Backlinks and Link Building: JavaScript-driven websites may face challenges when it comes to link building, as some external websites may not effectively parse or link to JavaScript-generated content. Consider strategies like outreach campaigns and content marketing to build high-quality backlinks.

25. Monitoring and Analytics: Regularly monitor your website's performance and SEO metrics using tools like Google Analytics. Analyze user behavior, conversion rates, and other key data to make informed decisions and optimize your JavaScript implementation.

26. Canonical URLs: Implement canonical URLs to avoid duplicate content issues when using JavaScript to dynamically generate URLs. This helps search engines understand which version of the page is the preferred one.

27. Meta Tags: Use JavaScript to dynamically generate meta tags, such as meta titles and descriptions, for each page. These tags play an important role in search engine rankings and can influence click-through rates from search results.

28. Content Loading: Utilize lazy loading techniques to improve page load speed, especially for images or other heavy media. This ensures that search engines can still crawl and index your content without significant delays.

29. Dynamic XML Sitemaps: If your website generates content dynamically through JavaScript, consider implementing dynamic XML sitemaps that reflect these changes. This allows search engines to discover and index new or updated pages efficiently.

30. Structured URLs: While URL structure may not directly impact search engine rankings, having descriptive and user-friendly URLs can lead to higher click-through rates from search results. Use JavaScript to create clean and meaningful URLs.

31. Internationalization (hreflang): If your website has international versions targeting different languages or regions, use JavaScript to implement hreflang tags. These tags help search engines understand which version of your content is relevant to specific geographic locations.

32. Handling AJAX Crawling: If you heavily rely on AJAX-based navigation or content loading, ensure that your website handles AJAX crawling properly. Use techniques like hashbang URLs or pushState to enable search engines to access and understand your AJAX-driven content.

33. Make Use of SEO Plugins and Libraries: Consider leveraging existing SEO plugins or libraries for popular JavaScript frameworks like React or Angular. These tools can help address common SEO challenges associated with these frameworks.

34. Monitor JavaScript Framework Updates: If your website uses a JavaScript framework or library, stay updated with their releases and ensure that you're using the latest versions. Framework updates often address performance, security, and SEO-related issues.

35. Structured Data Testing: Use Google's Structured Data Testing Tool or other similar tools to validate and test the structured data markup implemented on your website. This ensures that search engines can understand and interpret your structured data correctly.
To enhance SEO with JavaScript, it's crucial to prioritize crawlability by allowing search engines access to your JavaScript content. Use internal linking through regular anchor tags, maintaining a proper website structure for search engines to navigate. Adopt a clean URL structure with pushState History API, favoring search engine-friendly links. Regularly test your website for crawlability issues using tools like Google Search Console. Consider HTML snapshots for situations where search engines struggle with JavaScript, providing a fallback for content indexing. Optimize JavaScript for site speed, addressing render-blocking elements to minimize latency. Additionally, focus on responsive design, accessibility, and user experience, ensuring your website caters to mobile users and complies with SEO best practices.
https://returnsandrefund.com
  •