magento / pwa-studio

🛠Development tools to build, optimize and deploy Progressive Web Applications for Magento 2.
https://developer.adobe.com/commerce/pwa-studio/
Open Software License 3.0
1.06k stars 682 forks source link

[Issue] [FEATURE] Added default Rendertron support #3166

Closed m2-assistant[bot] closed 3 years ago

m2-assistant[bot] commented 3 years ago

This issue is automatically created based on existing pull request: magento/pwa-studio#3058: [FEATURE] Added default Rendertron support


Description

Many frontend frameworks rely on JavaScript to show content. This can mean Google might take some time to index your content or update the indexed content. One workaround option is to implement dynamic rendering. Dynamic rendering means switching between client-side rendered and pre-rendered content for specific user agents. This codelab will walk you through implementing dynamic rendering using Rendertron, which is an open source solution based on headless Chromium.

source: https://codelabs.developers.google.com/codelabs/dynamic-rendering#0

With 3 new environment variables you can easily setup Server Side Rendering with Rendertron.

It is possible to self-host Rendertron or even refer to SeoSnap (https://seosnap.io/)

Acceptance

Verification Stakeholders

Specification

Verification Steps

  1. Add the following lines to your .env (important: in this example i use the appspot rendertron which shouldn't be used in production)
    RENDERTRON_URL=https://localhost:3000/render
    RENDERTRON_USER_AGENTS="PreCacher|SeoScan|SitemapCacheWarmer|Screaming|Mojolicious|googlebot|bingbot|yandex|Whatsapp|baiduspider|twitterbot|facebookexternalhit|rogerbot|linkedinbot|embedly|quora link preview|showyoubot|outbrain|pinterest|slackbot|vkShare|W3C_Validator|Lighthouse"
    RENDERTRON_EXCLUDE_URL_PATTERN="graphql|\.(js|css|xml|less|png|jpg|jpeg|gif|pdf|doc|txt|ico|rss|zip|mp3|rar|exe|wmv|doc|avi|ppt|mpg|mpeg|tif|wav|mov|psd|ai|xls|mp4|m4a|swf|dat|dmg|iso|flv|m4v|torrent|ttf|woff|svg|eot)"
  2. Install Rendertron locally and run it on port 3000 or use https://render-tron.appspot.com/
  3. Switch the user-agent to for example googlebot and you should get a fully rendered page
  4. It is possible that you have to set closeBrowser in the rendertron configuration to true

image

Checklist

sirugh commented 3 years ago

@magento export issue to JIRA project PWA as Story

github-jira-sync-bot commented 3 years ago

:white_check_mark: Jira issue https://jira.corp.magento.com/browse/PWA-1715 is successfully created for this GitHub issue.