{"id":18750668,"url":"https://github.com/webiny/staticrender","last_synced_at":"2025-04-12T23:32:22.004Z","repository":{"id":62547936,"uuid":"83650519","full_name":"webiny/StaticRender","owner":"webiny","description":"An app that renders your javascript/reactjs app server side when a request comes from a bot or a crawler.","archived":false,"fork":false,"pushed_at":"2017-09-29T06:52:05.000Z","size":65,"stargazers_count":2,"open_issues_count":0,"forks_count":2,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-03-26T18:05:52.052Z","etag":null,"topics":["nodejs","phantomjs","php","seo","server-side-rendering","webiny"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/webiny.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-03-02T07:54:38.000Z","updated_at":"2019-11-27T05:38:23.000Z","dependencies_parsed_at":"2022-11-02T22:30:31.090Z","dependency_job_id":null,"html_url":"https://github.com/webiny/StaticRender","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webiny%2FStaticRender","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webiny%2FStaticRender/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webiny%2FStaticRender/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webiny%2FStaticRender/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/webiny","download_url":"https://codeload.github.com/webiny/StaticRender/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248647257,"owners_count":21139081,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["nodejs","phantomjs","php","seo","server-side-rendering","webiny"],"created_at":"2024-11-07T17:12:44.431Z","updated_at":"2025-04-12T23:32:19.726Z","avatar_url":"https://github.com/webiny.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Static render\nStatic render is an app that does server side render of your Webiny React app and produces a static HTML snapshot.\n\nThe app only kicks in when a bot visits the site and it works only if the site is in `production` mode.\n\n## Reason behind this app\nWe use Webiny, which is a React based platform, to build both websites as well as web applications. For web applications it doesn’t really matter, but for  **websites**, it's important that they  can be properly indexed by bots and other crawlers.\n\nGoogle claims that their bot can read and execute JavaScript, which is true, but only partially. There are some limitations, which are not documented and we are not certain what they are exactly. But we know that there are some because some of our pages were not indexed properly or not indexed at all, which is bad for us and our customers.\n\nAnother reason for building this app is that other search engines, like Bing, Yahoo, Baidu, DuckDuckGo and others, they don’t execute JS at all. And finally, sharing a JS page on Facebook or Twitter, just doesn’t work.\n\n## Dependencies\nThis is a Webiny app, meaning you need to use Webiny platform as the foundation for your website to use this application. To learn more about Webiny, head over to [http://www.webiny.com/](http://www.webiny.com/)\n\nAdditionally you need to have the following items:\n* Node 7 or greater\n* PhantomJs 2.1.1 or greater\n\n### PhantomJs 2.5.0\nAt the point of writing this file, Phantom 2.5.0-beta was released. From that version onwards PhantomJs supports ES6, so we jumped on the beta ship straight away.\nSince we are transpiling our JS using webpack, version 2.1.1 is also enough to render the pages correctly. \n\nInstalling the 2.5.0-beta requires a few steps and here is what you need to do if you are running Ubuntu (like our Vagrant machine):\n\n1. Download the binary from this link:\n[https://bitbucket.org/ariya/phantomjs/downloads/](https://bitbucket.org/ariya/phantomjs/downloads/)\n\nExtract the archive:\n```\ntar -zxvf {archive name here}\n```\n\nRun the install scripts (and update the paths to match the version you downloaded):\n```\nsudo add-apt-repository ppa:ubuntu-toolchain-r/test\n\nsudo apt-get update\n\nsudo apt-get install libstdc++6 libwebp-dev libhyphen-dev libicu-dev gcc-4.9 g++-4.9\n\nsudo mv phantomjs-2.5.0-beta-ubuntu-trusty /usr/local/share/\n\nsudo ln -sf /usr/local/share/phantomjs-2.5.0-beta-ubuntu-trusty/bin/phantomjs /usr/bin\n\nsudo chmod +x /usr/local/share/phantomjs-2.5.0-beta-ubuntu-trusty/bin/phantomjs\n\nphantomjs --version\n```\n\n## Configuration\nThe app has few config parameters. Here is a sample config and the explanation below:\n\n```yaml\nStaticRender:\n    Settings:\n        ResourceTimeout: 1000\n        CacheTtl: 86400\n        PathToPhantomJs: '/usr/bin/phantomjs'\n        PathToNode: '/home/vagrant/.nvm/versions/node/v7.7.1/bin/node'\n```\n\n`ResourceTimeout`\nDefines how log to wait before taking the snapshot of the DOM.\nIf you see that some of your components are not loading, try increasing the number.\nThe number is in milliseconds.\n\n `CacheTtl`\nOnce a snapshot is created, it is cached and this number defines for how long. The number is in seconds.\n\n`PathToPhantomJs`\nThis is the path to PhantomJs executable. If you installed PhantomJs using the steps in the previous section, you can set the path to the value that’s in the sample config.\n\n`PathToNode`\nThis is path to your node executable. If you made couple of updates to your node installation, the app might run an older version of node, depending on how your paths are set. By forcing a specific path to the node app, you can make sure it executes the commands using the latest node version.\n\n## Features\nThe app also has a user interface. Using the interface via the Webiny administration you can access additional features. Those features are:\n* List of all the cached URLs\n* Option to delete a certain cache entry\n* Force a refresh of a particular cache entry\n* View the rendered HTML content of a certain cache entry\n* `Fetch as bot` to see the output of the requested URL as if you were a bot\n\n## License and Contributions\n\nContributing \u003e Feel free to send PRs.\n\nLicense \u003e [MIT](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebiny%2Fstaticrender","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwebiny%2Fstaticrender","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebiny%2Fstaticrender/lists"}